/** * Return a Session to the pool * * @param pooled_session the session to recycle */ public void recycle(PooledSession pooledSession) { // sessions used long-term by the server receive side are not cached, // only non-null destinations are temp queues final boolean replyCapable = pooledSession.destination() != null; boolean discard = false; synchronized (this) { // re-cache session, closing if it cannot be it can be accomodated // discard = replyCapable ? (!replyCapableSessionCache.recycle(pooledSession)) : (!sendOnlySessionCache.recycle(pooledSession)); } if (discard) { try { pooledSession.close(); } catch (JMSException e) { LOG.log(Level.WARNING, "JMS Session discard failed: " + e); } } }