Remove support for pooled-jms as it is not JMS 3.0 compatible

Closes gh-28701
This commit is contained in:
Andy Wilkinson 2021-11-16 12:10:52 +00:00
parent c8fd5f0080
commit 6e7f2766c8
4 changed files with 0 additions and 216 deletions

View File

@ -126,9 +126,6 @@ dependencies {
optional("org.liquibase:liquibase-core") {
exclude group: "javax.xml.bind", module: "jaxb-api"
}
optional("org.messaginghub:pooled-jms") {
exclude group: "org.apache.geronimo.specs", module: "geronimo-jms_2.0_spec"
}
optional("org.mongodb:mongodb-driver-reactivestreams")
optional("org.mongodb:mongodb-driver-sync")
optional("org.quartz-scheduler:quartz")

View File

@ -1,66 +0,0 @@
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jms;
import javax.jms.ConnectionFactory;
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
/**
* Factory to create a {@link JmsPoolConnectionFactory} from properties defined in
* {@link JmsPoolConnectionFactoryProperties}.
*
* @author Stephane Nicoll
* @since 2.1.0
*/
public class JmsPoolConnectionFactoryFactory {
private final JmsPoolConnectionFactoryProperties properties;
public JmsPoolConnectionFactoryFactory(JmsPoolConnectionFactoryProperties properties) {
this.properties = properties;
}
/**
* Create a {@link JmsPoolConnectionFactory} based on the specified
* {@link ConnectionFactory}.
* @param connectionFactory the connection factory to wrap
* @return a pooled connection factory
*/
public JmsPoolConnectionFactory createPooledConnectionFactory(ConnectionFactory connectionFactory) {
JmsPoolConnectionFactory pooledConnectionFactory = new JmsPoolConnectionFactory();
pooledConnectionFactory.setConnectionFactory(connectionFactory);
pooledConnectionFactory.setBlockIfSessionPoolIsFull(this.properties.isBlockIfFull());
if (this.properties.getBlockIfFullTimeout() != null) {
pooledConnectionFactory
.setBlockIfSessionPoolIsFullTimeout(this.properties.getBlockIfFullTimeout().toMillis());
}
if (this.properties.getIdleTimeout() != null) {
pooledConnectionFactory.setConnectionIdleTimeout((int) this.properties.getIdleTimeout().toMillis());
}
pooledConnectionFactory.setMaxConnections(this.properties.getMaxConnections());
pooledConnectionFactory.setMaxSessionsPerConnection(this.properties.getMaxSessionsPerConnection());
if (this.properties.getTimeBetweenExpirationCheck() != null) {
pooledConnectionFactory
.setConnectionCheckInterval(this.properties.getTimeBetweenExpirationCheck().toMillis());
}
pooledConnectionFactory.setUseAnonymousProducers(this.properties.isUseAnonymousProducers());
return pooledConnectionFactory;
}
}

View File

@ -1,137 +0,0 @@
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jms;
import java.time.Duration;
/**
* Configuration properties for connection factory pooling.
*
* @author Stephane Nicoll
* @since 2.1.0
*/
public class JmsPoolConnectionFactoryProperties {
/**
* Whether a JmsPoolConnectionFactory should be created, instead of a regular
* ConnectionFactory.
*/
private boolean enabled;
/**
* Whether to block when a connection is requested and the pool is full. Set it to
* false to throw a "JMSException" instead.
*/
private boolean blockIfFull = true;
/**
* Blocking period before throwing an exception if the pool is still full.
*/
private Duration blockIfFullTimeout = Duration.ofMillis(-1);
/**
* Connection idle timeout.
*/
private Duration idleTimeout = Duration.ofSeconds(30);
/**
* Maximum number of pooled connections.
*/
private int maxConnections = 1;
/**
* Maximum number of pooled sessions per connection in the pool.
*/
private int maxSessionsPerConnection = 500;
/**
* Time to sleep between runs of the idle connection eviction thread. When negative,
* no idle connection eviction thread runs.
*/
private Duration timeBetweenExpirationCheck = Duration.ofMillis(-1);
/**
* Whether to use only one anonymous "MessageProducer" instance. Set it to false to
* create one "MessageProducer" every time one is required.
*/
private boolean useAnonymousProducers = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isBlockIfFull() {
return this.blockIfFull;
}
public void setBlockIfFull(boolean blockIfFull) {
this.blockIfFull = blockIfFull;
}
public Duration getBlockIfFullTimeout() {
return this.blockIfFullTimeout;
}
public void setBlockIfFullTimeout(Duration blockIfFullTimeout) {
this.blockIfFullTimeout = blockIfFullTimeout;
}
public Duration getIdleTimeout() {
return this.idleTimeout;
}
public void setIdleTimeout(Duration idleTimeout) {
this.idleTimeout = idleTimeout;
}
public int getMaxConnections() {
return this.maxConnections;
}
public void setMaxConnections(int maxConnections) {
this.maxConnections = maxConnections;
}
public int getMaxSessionsPerConnection() {
return this.maxSessionsPerConnection;
}
public void setMaxSessionsPerConnection(int maxSessionsPerConnection) {
this.maxSessionsPerConnection = maxSessionsPerConnection;
}
public Duration getTimeBetweenExpirationCheck() {
return this.timeBetweenExpirationCheck;
}
public void setTimeBetweenExpirationCheck(Duration timeBetweenExpirationCheck) {
this.timeBetweenExpirationCheck = timeBetweenExpirationCheck;
}
public boolean isUseAnonymousProducers() {
return this.useAnonymousProducers;
}
public void setUseAnonymousProducers(boolean useAnonymousProducers) {
this.useAnonymousProducers = useAnonymousProducers;
}
}

View File

@ -1239,16 +1239,6 @@ bom {
]
}
}
library("Pooled JMS", "1.2.2") {
prohibit("[2.0.0,)") {
because "it requires Java 11"
}
group("org.messaginghub") {
modules = [
"pooled-jms"
]
}
}
library("Postgresql", "42.3.1") {
group("org.postgresql") {
modules = [