/** * Reset the underlying shared Connection, to be reinitialized on next access. */ public void resetConnection() { synchronized (this.connectionMonitor) { if (this.target != null) { closeConnection(this.target); } this.target = null; this.connection = null; } }
/** * Initialize the underlying shared Connection. * <p>Closes and reinitializes the Connection if an underlying * Connection is present already. * @throws javax.jms.JMSException if thrown by JMS API methods */ public void initConnection() throws JMSException { if (getTargetConnectionFactory() == null) { throw new IllegalStateException( "'targetConnectionFactory' is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { if (this.target != null) { closeConnection(this.target); } this.target = doCreateConnection(); prepareConnection(this.target); if (logger.isInfoEnabled()) { logger.info("Established shared JMS Connection: " + this.target); } this.connection = getSharedConnectionProxy(this.target); } }