/** * Creates a connection using this object's connection factory and stores * that connection in the given context object. * * NOTE: this does <b>not</b> set the connection in this processor object. * If the caller wants the created connection cached in this processor * object, {@link #cacheConnection} must be passed the connection * found in the context after this method returns. See also * {@link #createOrReuseConnection(ConnectionContext, boolean)}. * * @param context the context where the new connection is stored * @throws JMSException any error * @throws IllegalStateException if the context is null * * @see #createOrReuseConnection(ConnectionContext, boolean) * @see #cacheConnection */ protected void createConnection(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } ConnectionFactory factory = getConnectionFactory(); Connection conn = factory.createConnection(); context.setConnection(conn); }
/** * Creates a connection using this object's connection factory and stores * that connection in the given context object. * * NOTE: this does <b>not</b> set the connection in this processor object. * If the caller wants the created connection cached in this processor * object, {@link #cacheConnection} must be passed the connection * found in the context after this method returns. See also * {@link #createOrReuseConnection(ConnectionContext, boolean)}. * * @param context the context where the new connection is stored * @throws JMSException any error * @throws IllegalStateException if the context is null * * @see #createOrReuseConnection(ConnectionContext, boolean) * @see #cacheConnection */ protected void createConnection(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } ConnectionFactory factory = getConnectionFactory(); Connection conn = factory.createConnection(); context.setConnection(conn); }
if (conn != null) { context.setConnection(conn); } else {
if (conn != null) { context.setConnection(conn); } else {