protected void cacheConnection(Connection connection, boolean closeExistingConnection) {
        if (this.connection != null && closeExistingConnection) {
            try {
                // make sure it is closed to free up any resources it was using
                this.connection.close();
            } catch (JMSException e) {
                msglog.errorCannotCloseConnectionMemoryMightLeak(e);
            }
        }

        this.connection = connection;
    }
protected void cacheConnection ( Connection connection , boolean closeExistingConnection ) { if ( this . connection != null && closeExistingConnection ) { try { this . connection . close ( ) ; } catch ( JMSException e ) { msglog . errorCannotCloseConnectionMemoryMightLeak ( e ) ; } } this . connection = connection ; }
To store a connection in this processor object, call this setter.
If there was already a cached connection, it will be closed.

NOTE: Calling {@link #createConnection(ConnectionContext)} does
<b>not</b> set this processor's connection - that method only creates the
connection and puts that connection in the context. It does not save that
connection in this processor object. You must explicitly set the
connection via this method if you want that connection cached here. See
also {@link #createOrReuseConnection(ConnectionContext, boolean)}.

@param connection the connection
@param closeExistingConnection if true, and if there was already a connection
cached, that connection will be closed. Otherwise
it will be left alone but the new connection
will take its place.

@see #createOrReuseConnection(ConnectionContext, boolean)