/** * Return a cached or newly created object * * @return an object */ public E get() throws Exception { E ret = poll(); if (ret == null) { ret = create(); } return ret; }
/** * Shutdown the session factory. */ public void shutdown() { try { PooledSession curr; if (replyCapableSessionCache != null) { curr = replyCapableSessionCache.poll(); while (curr != null) { curr.close(); curr = replyCapableSessionCache.poll(); } } if (sendOnlySessionCache != null) { curr = sendOnlySessionCache.poll(); while (curr != null) { curr.close(); curr = sendOnlySessionCache.poll(); } } theConnection.close(); } catch (JMSException e) { LOG.log(Level.WARNING, "queue connection close failed: " + e); } // help GC // replyCapableSessionCache = null; sendOnlySessionCache = null; }