|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -205,10 +205,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess |
|
|
|
doInitialize(); |
|
|
|
doInitialize(); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (JMSException ex) { |
|
|
|
catch (JMSException ex) { |
|
|
|
synchronized (this.sharedConnectionMonitor) { |
|
|
|
releaseSharedConnection(); |
|
|
|
ConnectionFactoryUtils.releaseConnection(this.sharedConnection, getConnectionFactory(), this.autoStartup); |
|
|
|
|
|
|
|
this.sharedConnection = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
throw convertJmsAccessException(ex); |
|
|
|
throw convertJmsAccessException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -248,10 +245,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
|
if (sharedConnectionEnabled()) { |
|
|
|
if (sharedConnectionEnabled()) { |
|
|
|
synchronized (this.sharedConnectionMonitor) { |
|
|
|
releaseSharedConnection(); |
|
|
|
ConnectionFactoryUtils.releaseConnection(this.sharedConnection, getConnectionFactory(), false); |
|
|
|
|
|
|
|
this.sharedConnection = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -391,9 +385,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected final void refreshSharedConnection() throws JMSException { |
|
|
|
protected final void refreshSharedConnection() throws JMSException { |
|
|
|
synchronized (this.sharedConnectionMonitor) { |
|
|
|
synchronized (this.sharedConnectionMonitor) { |
|
|
|
ConnectionFactoryUtils.releaseConnection( |
|
|
|
releaseSharedConnection(); |
|
|
|
this.sharedConnection, getConnectionFactory(), this.sharedConnectionStarted); |
|
|
|
|
|
|
|
this.sharedConnection = null; |
|
|
|
|
|
|
|
this.sharedConnection = createSharedConnection(); |
|
|
|
this.sharedConnection = createSharedConnection(); |
|
|
|
if (this.sharedConnectionStarted) { |
|
|
|
if (this.sharedConnectionStarted) { |
|
|
|
this.sharedConnection.start(); |
|
|
|
this.sharedConnection.start(); |
|
|
|
@ -474,6 +466,19 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Release the shared Connection, if any. |
|
|
|
|
|
|
|
* @since 6.1 |
|
|
|
|
|
|
|
* @see ConnectionFactoryUtils#releaseConnection |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected final void releaseSharedConnection() { |
|
|
|
|
|
|
|
synchronized (this.sharedConnectionMonitor) { |
|
|
|
|
|
|
|
ConnectionFactoryUtils.releaseConnection( |
|
|
|
|
|
|
|
this.sharedConnection, getConnectionFactory(), this.sharedConnectionStarted); |
|
|
|
|
|
|
|
this.sharedConnection = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the shared JMS Connection maintained by this container. |
|
|
|
* Return the shared JMS Connection maintained by this container. |
|
|
|
* Available after initialization. |
|
|
|
* Available after initialization. |
|
|
|
|