jstrachan 2002/11/28 07:01:27 Modified: messenger/src/java/org/apache/commons/messenger MessengerSupport.java Log: Added some extra tracing information for the creation and desctruction of MessageConsumers Revision Changes Path 1.33 +28 -13 jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/MessengerSupport.java Index: MessengerSupport.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/MessengerSupport.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- MessengerSupport.java 7 Nov 2002 19:13:47 -0000 1.32 +++ MessengerSupport.java 28 Nov 2002 15:01:27 -0000 1.33 @@ -42,6 +42,9 @@ import javax.jms.TopicRequestor; import javax.jms.TopicSession; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** <p><code>MessengerSupport</code> is an abstract base class which implements * most of the functionality of Messenger. Derivations need to specify the * connection and session creation and the pooling strategy.</p> @@ -51,6 +54,9 @@ */ public abstract class MessengerSupport implements Messenger { + /** Logger */ + private static final Log log = LogFactory.getLog(MessengerSupport.class); + private static final boolean CACHE_REQUESTOR = true; /** The name of the Messenger */ @@ -1009,14 +1015,14 @@ Session session, Destination destination) throws JMSException { - return createMessageConsumer(session, destination); - /* - MessageConsumer consumer = (MessageConsumer) consumers.get( destination ); - if ( consumer == null ) { - consumer = createMessageConsumer( session, destination ); - } - return consumer; - */ + + MessageConsumer consumer = createMessageConsumer(session, destination); + + if (log.isDebugEnabled()) { + log.debug( "Created new consumer: " + consumer + " on destination: " + destination ); + } + + return consumer; } /** @return a MessageConsumer for the given session, destination and selector */ @@ -1025,8 +1031,14 @@ Destination destination, String selector) throws JMSException { - // XXXX: could do caching one day - return createMessageConsumer(session, destination, selector); + + MessageConsumer consumer = createMessageConsumer(session, destination, selector); + + if (log.isDebugEnabled()) { + log.debug( "Created new consumer: " + consumer + " on destination: " + destination + " selector: " + selector ); + } + + return consumer; } /** @@ -1035,7 +1047,10 @@ * be able to cache then */ protected void returnMessageConsumer(MessageConsumer messageConsumer) throws JMSException { - // XXXX: could do caching one day + if (log.isDebugEnabled()) { + log.debug( "Closing consumer: " + messageConsumer ); + } + if ( messageConsumer != null ) { messageConsumer.close(); }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>