commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [messenger] patch for working with JBossMQ
Date Tue, 26 Feb 2002 01:06:50 GMT
Hi Anil

I've applied your changes - thanks!. Sorry it took a little while.

I made a slight modification, I've added a boolean 'topic' property to SessionFactory which can be specified in the XML deployment descriptor to force a particular Connection or ConnectionFactory to be in topic or queue mode - though this property is auto-detected and swizzled if its wrong. So in cases where a provider implements both Topic and Queue interfaces you can switch which mode to operate - otherwise the type of the returned objects are used to switch into topic or queue mode. I think this makes the code a little simpler. 

Please let me know if these changes work for you - hopefully you'll be able to switch to the main Messenger distribution now and not use your own patched version.

James
  ----- Original Message ----- 
  From: Anil Kumar C 
  To: Jakarta Commons Developers List 
  Sent: Saturday, February 16, 2002 12:11 AM
  Subject: Re: [messenger] patch for working with JBossMQ


  I too have a similar approach to differentiate between a topic and a queue using a flag. I have also implemented a 
  seperate class that takes care of doing . The current implementation using a flag to toggle between the existing vs the 
  new implementation.

  The new methods mentioned below have been added to the Messenger and are implemented in MessengerSupport

  I have also added a patch to support lookup mechanism for getting a destination. In weblogic, use of a createQueue or a createTopic
  requires to setup a temporary template to all destinations.  This implementation defaults to a lookup mechanism and can be reverted back
  to the existing mode through a simple flag.

  Regarding modifications to messenger.xml, I haven't done anything for weblogic. I am not using the MessageDigester for initalization as I have
  all the data in a database  which is my source rather than an XML.

  The attachment contains all the files that I have modified.

  Anil

  James Strachan wrote:

----- Original Message -----From: "Anil Kumar C" <anilkc@mindtree.com>
I had similar problems while using with weblogic. I also have done a fixwhich is very similar to what you mentioned.I have also added additional these additional methods    public int getDeliveryMode(Destination destination) throws
JMSException;
    public boolean getDisableMessageID(Destination destination) throwsJMSException;    public boolean getDisableMessageTimestamp(Destination destination)throws JMSException;    public int getPriority(Destination destination) throws JMSException;    public long getTimeToLive(Destination destination) throws
JMSException;
    public void setDeliveryMode(Destination destination,intdeliveryMode) throws JMSException;    public void setDisableMessageID(Destination destination, booleanvalue) throws JMSException;    public void setDisableMessageTimestamp(Destinationdestination,boolean value) throws JMSException;    public void setPriority(Destination destination,int defaultPriority)throws JMSException;    public void setTimeToLive(Destination destination,long timeToLive)throws JMSException;Let me know if you are interested in adding these methods and I willsend over the patch
Please do send over the patch and I'll add it to CVS.Incidentally do you have a Messenger.xml that works with WebLogic? If soit'll be nice to add that to the CVS repository as well...James
AnilJames Strachan wrote:
From: "Saimon Moore" <saimonmoore@yahoo.co.uk>
Well I've managed to patch the code up to work withJBossMQ.
Great! Thanks Saimon I'll apply these patches now.
There were two problems:1. When a ConnectionFactory is looked up in JBossNS,you get an org.jboss.mq.SpyConnectionFactory objectreturned which you have to cast to the appropriateobject i.e. QueueConnectionFactory orTopicConnectionFactory. However, if you test theinstance, both of the previous are valid.. i.e.<code>if (factory instanceof TopicConnectionFactory)</code>will return true even if factory has been previouslycast to QueueConnectionFactory and vice-versa.There is a similar problem when creating theConnection. The jboss connection factory returns anorg.jboss.mq.SpyConnection object that has to be castto either QueueConnection or TopicConnection butchecking the instance of the connection is notsufficient to diferentiate between the two.What I did to overcome this is re-implement bothcreateConnection() and createSession() fromSessio
nFactory in JNDISessionFactory relying on thelookup name, to differentiate and correctly create theappropriate factories,connections and sessions.
Maybe other providers might do this kinda thing, so maybe we should add aboolean property to JNDISessionFactory so that it doesn't matter what thename is in JNDI, we can coerce it into a Topic or Queue connection if theobject implements both interfaces.e.g.<jndi lookupName="TopicConnectionFactory" topic="true">...<jndi lookupName="QueueConnectionFactory" topic="false">...
Anyway, it's working fine now but I'm in the processof testing it out with other JMS providers e.g.AshnaMQ, and j2eesdk1.3 (By the way...what's theprotocol used for this i.e. the provider url?)
The existing Messenger.xml in CVS should work fine for j2eesdk - though Ithink the JNDI lookup name depends on if you are inside the j2ee server
or
not. From memory I think its either TopicConnection (outside) orjava:env/TopicConnection (inside j2ee).James_________________________________________________________Do You Yahoo!?Get your free @yahoo.com address at http://mail.yahoo.com--To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>

_________________________________________________________Do You Yahoo!?Get your free @yahoo.com address at http://mail.yahoo.com




------------------------------------------------------------------------------


  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: SessionFactory.java,v 1.9 2001/10/25 21:07:12 jstrachan Exp $
   */
  package org.apache.commons.messenger;

  import java.io.Serializable;
  import java.util.Properties;

  import javax.jms.Connection;
  import javax.jms.ConnectionFactory;
  import javax.jms.JMSException;
  import javax.jms.MessageListener;
  import javax.jms.QueueConnection;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.ServerSessionPool;
  import javax.jms.Session;
  import javax.jms.Destination;
  import javax.jms.TopicConnection;
  import javax.jms.TopicConnectionFactory;
  import javax.jms.MessageProducer;


  /** <p><code>SessionFactory</code> is a Factory of JMS Session objects.
    * It can be configured with a JMS Connection object to use or can use 
    * a JMS ConnectionFactory instance to create the JMS Connection lazily</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.9 $
    */
  public class SessionFactory {

      /** The JMS connection used to create JMS sessions */
      private Connection connection;
      /** The JMS ConnectionFactory used to create JMS Connection instances */
      private ConnectionFactory connectionFactory;
      /** JMS acknowlege mode used on each session */
      private int acknowlegeMode = Session.AUTO_ACKNOWLEDGE;    
      /** whether JMS sessions should be transacted */
      private boolean transacted;
      /** the optional username used when creating a new JMS connection via a JMS ConnectionFactory */
      private String username;
      /** the optional password used when creating a new JMS connection via a JMS ConnectionFactory */
      private String password;
      /** the properties used to create the connection */
      protected Properties properties;

  //TAKO CHANGES - START
      /** MessengerIdentifier that enables the SessionFactory to differentiate between a Topic/Queue */
      protected MessengerIdentifier messengerIdentifier = null;

      /** Default Session Factory Constructor*/
      public SessionFactory () {
          messengerIdentifier = new MessengerIdentifier();
      }

      /** Checks if a connection is associated with a Topic */
      protected boolean isTopic(Connection connection) throws JMSException  {
          return messengerIdentifier.isTopic(connection);
      }

      /** Checks if the factory is associated with a Topic */
      protected boolean isTopic(ConnectionFactory factory)  throws JMSException {
          return messengerIdentifier.isTopic(factory);
      }

      /** Checks if the session is associated with a Topic */
      protected boolean isTopic(Session session) throws JMSException {
          return messengerIdentifier.isTopic(session);
      }

      /** Checks if the producer is associated with a Topic */
      protected boolean isTopic(MessageProducer producer) throws JMSException {
          return messengerIdentifier.isTopic(producer);
      }

      /** Provides users the option of marking a SessionFactory to function for a Topic or a Queue.*/
      public void setIsTopic(boolean isTopic) throws JMSException {
          messengerIdentifier.setIsTopic(isTopic);
      }

      /** Enables users to identify if the factory is associated with a Queue or a Topic */
      public boolean getIsTopic ()  throws JMSException {
          return messengerIdentifier.getIsTopic();
      }

      /**
       * Provides Easy Methods to find a Destination
       */
      protected Destination getDestination( String destinationName ) throws JMSException {
          return null;
      }
  //TAKO CHANGES - END

      /** Creates a new Session instance */
      public Session createSession(Connection connection) throws JMSException {
          if ( isTopic ( connection ) ) {
              TopicConnection topicConnection = (TopicConnection) connection;
              return topicConnection.createTopicSession( isTransacted(), getAcknowledgeMode() );
          }
          else {
              QueueConnection queueConnection = (QueueConnection) connection;
              return queueConnection.createQueueSession( isTransacted(), getAcknowledgeMode() );
          }
      }   
      
      /** Creates a new Session instance */
      public Session createSession() throws JMSException {
          Connection connection = getConnection();
          if ( isTopic ( connection ) ) {
              TopicConnection topicConnection = (TopicConnection) connection;
              return topicConnection.createTopicSession( isTransacted(), getAcknowledgeMode() );
          }
          else {
              QueueConnection queueConnection = (QueueConnection) connection;
              return queueConnection.createQueueSession( isTransacted(), getAcknowledgeMode() );
          }
      }   
      
      public ServerSessionPool createServerSessionPool(MessageListener messageListener, int maxThreads) throws JMSException {
          return new DefaultServerSessionPool(this, messageListener, maxThreads);
      }

      /** Factory method used to create a connection */
      public Connection createConnection() throws JMSException {
          ConnectionFactory factory = getConnectionFactory();
          if ( factory == null ) {
              throw new JMSException( "No ConnectionFactory configured. Cannot create a JMS Session" );
          }
          //System.out.println( "About to create a connection from: " + factory );
          
          if ( isTopic(factory) ) {
              try {
                  return createTopicConnection((TopicConnectionFactory) factory);
              }
              catch (ClassCastException e) {
                  // XXXX: for some reason in J2EE SDK QueueConnectionFactory 
                  // objects appear to be  TopicConnectionFactory objects 
                  // for some wierd reason
                  return createQueueConnection((QueueConnectionFactory) factory);
              }
          }
          else {
              return createQueueConnection((QueueConnectionFactory) factory);
          }
      }

      /** Closes the JMS Connection that this object is using, if any */
      public void close() throws JMSException {
          if ( connection != null ) {
              connection.close();
              connection = null;
          }
      }
      
      // Properties
      //-------------------------------------------------------------------------    
      
      /** Returns the JMS connection used to create new sessions */
      public Connection getConnection() throws JMSException {
          if ( connection == null ) {
              connection = createConnection();
              connection.start();
          }
          return connection;
      }
      
      public void setConnection(Connection connection) {
          this.connection = connection;
      }
      
      /** Returns the JMS ConnectionFactory used to create a new connection */
      public ConnectionFactory getConnectionFactory() throws JMSException {
          if ( connectionFactory == null ) {
              connectionFactory = createConnectionFactory();
          }
          return connectionFactory;
      }
      
      public void setConnectionFactory(ConnectionFactory connectionFactory) {
          this.connectionFactory = connectionFactory;
      }
      
      /** Returns true if sessions created by this factory should be transacted */
      public boolean isTransacted() {
          return transacted;
      }
      
      public void setTransacted(boolean transacted) {
          this.transacted = transacted;
      }
      
      
      /** Returns the JMS acknowledge mode used by the JMS sessions created by this session */
      public int getAcknowledgeMode() {
          return acknowlegeMode;
      }
      
      public void setAcknowledgeMode(int acknowlegeMode) {
          this.acknowlegeMode = acknowlegeMode;
      }

      
      /** Returns the optional username used when creating a new JMS connection via a JMS ConnectionFactory */
      public String getUsername() {
          return username;
      }
      
      public void setUsername(String username) {
          this.username = username;
      }
      
      /** Returns the optional password used when creating a new JMS connection via a JMS ConnectionFactory */
      public String getPassword() {
          return password;
      }
      
      public void setPassword(String password) {
          this.password = password;
      }

      /** Returns the Properties that can be used to configure the connection creation */
      public Properties getProperties() {
          if ( properties == null ) {
              properties = createProperties();
          }
          return properties;
      }
      
      public void setProperties(Properties properties) {
          this.properties = properties;
      }

      public void addProperty(String name, String value) {
          getProperties().setProperty(name, value);
      }
      
      
      // Implementation methods
      //-------------------------------------------------------------------------    
      
      protected QueueConnection createQueueConnection(QueueConnectionFactory queueConnectionFactory) throws JMSException {
          if ( username != null || password != null ) {
              return queueConnectionFactory.createQueueConnection( username, password );
          }
          else {
              return queueConnectionFactory.createQueueConnection();
          }
      }
      
      protected TopicConnection createTopicConnection(TopicConnectionFactory topicConnectionFactory) throws JMSException {
          if ( username != null || password != null ) {
              return topicConnectionFactory.createTopicConnection( username, password );
          }
          else {
              return topicConnectionFactory.createTopicConnection();
          }
      }
      
      
      /** Factory method used to create a connection factory. 
        * Derived classes may wish to use JNDI to load the ConnectionFactory
        */
      protected ConnectionFactory createConnectionFactory() throws JMSException {
          return null;
      }
      
      /** Factory method used to create the initial JNDI context properties.
        * Derived classes may wish to overload this method to provide different properties
        */
      protected Properties createProperties() {
          try {
              return new Properties( System.getProperties() );
          }
          catch (Throwable e) {
              // security exceptoin
              return new Properties();
          }
      }

  }




------------------------------------------------------------------------------


  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: Messenger.java,v 1.9 2001/10/25 21:07:12 jstrachan Exp $
   */
  package org.apache.commons.messenger;

  import java.io.Serializable;

  import javax.jms.BytesMessage;
  import javax.jms.Connection;
  import javax.jms.ConnectionConsumer;
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.MapMessage;
  import javax.jms.Message;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageListener;
  import javax.jms.ObjectMessage;
  import javax.jms.StreamMessage;
  import javax.jms.ServerSessionPool;
  import javax.jms.TextMessage;


  /** <p><code>Messenger</code> a facade over the JMS API making it easy to use JMS
    * and hiding much of the complexity of threading and configuration.
    * A Messenger will internally associate a JMS Session with the calling thread
    * so that all methods called in the same thread (such as inside a Servlet or 
    * taglib) will use the same JMS Session.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.9 $
    */
  public interface Messenger {

      /** Temporary hack - this method has been added so that Messenger works better with the digester */
      public String getName();

      /** Returns the destination for the given subject name */
      public Destination getDestination(String subject) throws JMSException;
      
      /** Returns a new temporary destination */
      public Destination createTemporaryDestination() throws JMSException;
      
      /** Sends a message on the given destination */
      public void send(Destination destination, Message message) throws JMSException;

      /** Sends a message on the given destination and blocks until a response is returned */
      public Message call(Destination destination, Message message) throws JMSException;

      /** Sends a message on the given destination and blocks until a response is returned or the given timeout period expires */
      public Message call(Destination destination, Message message, long timeoutMillis) throws JMSException;

      /** Receives a message on the given destination, blocking until one is returned */    
      public Message receive(Destination destination) throws JMSException;
      
      /** Receives a message on the given destination and message selector, blocking until one is returned */    
      public Message receive(Destination destination, String selector) throws JMSException;
      
      /** Receives a message on the given destination, blocking for the specified timeout */    
      public Message receive(Destination destination, long timeoutMillis) throws JMSException;
      
      /** Receives a message on the given destination and selector, blocking for the specified timeout */    
      public Message receive(Destination destination, String selector, long timeoutMillis) throws JMSException;
      
      /** Receives a message on the given destination without blocking or returns null */    
      public Message receiveNoWait(Destination destination) throws JMSException;

      /** Receives a message on the given destination and selector without blocking or returns null */    
      public Message receiveNoWait(Destination destination, String selector) throws JMSException;


      /** Creates a MessageConsumer for the given JMS Desintation
       */
      public MessageConsumer createConsumer(Destination destination) throws JMSException;
      
      /** Creates a MessageConsumer for the given JMS Desintation and JMS selector
       */
      public MessageConsumer createConsumer(Destination destination, String selector) throws JMSException;

      /** Allows this current thread to be given to the JMS connection to process messages. This
       * method can be useful for creating background processing threads
       */
      public void run();

      /** Returns the underlying JMS connection that this Messenger is using */
      public Connection getConnection() throws JMSException;
      
      /** Creates a ConnectionConsumer which is useful if used inside an application server
       * to associate multiple threads with consuming from a JMS destination */
      public ConnectionConsumer createConnectionConsumer(Destination destination, ServerSessionPool sessionPool, int maxMessages) throws JMSException;
      
      /** Creates a ConnectionConsumer which is useful if used inside an application server
       * to associate multiple threads with consuming from a JMS destination */
      public ConnectionConsumer createConnectionConsumer(Destination destination, String selector, ServerSessionPool sessionPool, int maxMessages) throws JMSException;
      
      /** Creates a new ServerSessionPool implementation with a given maximum number of threads
       * for use by a ConnectionConsumer
       */
      public ServerSessionPool createServerSessionPool(MessageListener messageListener, int maxThreads) throws JMSException;
      
      
      // Listener API
      //-------------------------------------------------------------------------    
      
      /** Adds a message listener on the given destination */
      public void addListener(Destination destination, MessageListener listener) throws JMSException;
      public void addListener(Destination destination, String selector, MessageListener listener) throws JMSException;

      public void removeListener(Destination destination, MessageListener listener) throws JMSException;
      public void removeListener(Destination destination, String selector, MessageListener listener) throws JMSException;
      
      
      // Message factory methods
      //-------------------------------------------------------------------------    
      
      public BytesMessage createBytesMessage() throws JMSException;
      
      public MapMessage createMapMessage() throws JMSException;
      
      public Message createMessage() throws JMSException;    
      
      public ObjectMessage createObjectMessage() throws JMSException;
      public ObjectMessage createObjectMessage(Serializable object) throws JMSException;
      
      public StreamMessage createStreamMessage() throws JMSException;
      
      public TextMessage createTextMessage() throws JMSException;
      public TextMessage createTextMessage(String text) throws JMSException;
      
      
      // Transaction related methods
      //-------------------------------------------------------------------------    
      
      /** Commits all messages done in this thread and releases any locks */
      public void commit() throws JMSException;
      
      /** Rolls back any messages done in this thread and releases any locks */
      public void rollback() throws JMSException;
      
      /** Closes the underlying JMS connection */
      public void close() throws JMSException;

      // Enhance Done in MindTree for TAKO Release
      //----------------------------------------------------------------------------

      public int getDeliveryMode(Destination destination) throws JMSException;
      public boolean getDisableMessageID(Destination destination) throws JMSException;
      public boolean getDisableMessageTimestamp(Destination destination) throws JMSException;
      public int getPriority(Destination destination) throws JMSException;
      public long getTimeToLive(Destination destination) throws JMSException;
      public void setDeliveryMode(Destination destination,int deliveryMode) throws JMSException;
      public void setDisableMessageID(Destination destination, boolean value) throws JMSException;
      public void setDisableMessageTimestamp(Destination destination,boolean value) throws JMSException;
      public void setPriority(Destination destination,int defaultPriority) throws JMSException;
      public void setTimeToLive(Destination destination,long timeToLive) throws JMSException;
  }




------------------------------------------------------------------------------


  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   *
   * $Id: MessengerSupport.java,v 1.16 2002/02/01 14:32:33 jstrachan Exp $
   */
  package org.apache.commons.messenger;

  import java.io.Serializable;
  import java.util.HashMap;
  import java.util.Map;

  import javax.jms.BytesMessage;
  import javax.jms.Connection;
  import javax.jms.ConnectionConsumer;
  import javax.jms.ConnectionFactory;
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.MapMessage;
  import javax.jms.Message;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageListener;
  import javax.jms.MessageProducer;
  import javax.jms.ObjectMessage;
  import javax.jms.Queue;
  import javax.jms.QueueConnection;
  import javax.jms.QueueRequestor;
  import javax.jms.QueueSender;
  import javax.jms.QueueSession;
  import javax.jms.Session;
  import javax.jms.StreamMessage;
  import javax.jms.ServerSessionPool;
  import javax.jms.TextMessage;
  import javax.jms.Topic;
  import javax.jms.TopicConnection;
  import javax.jms.TopicPublisher;
  import javax.jms.TopicRequestor;
  import javax.jms.TopicSession;


  /** <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>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.16 $
    */
  public abstract class MessengerSupport implements Messenger {

      private static final boolean CACHE_REQUESTOR = true;


      /** The name of the Messenger */
      private String name;

      /** are topic subscribers durable? */
      private boolean durable;

      /** the durable name used for durable topic based subscriptions */
      private String durableName;

      /** whether local messages are ignored when topic based subscription is used
       * with a message selector */
      private boolean noLocal;

      /** A Map of ListenerKey objects to MessageConsumer objects */
      private Map listeners = new HashMap();

      /** A Map of MessageConsumer objects indexed by Destination or Destination and selector */
      private Map consumers = new HashMap();

      /** A Map of MessageProducer objects indexed by Destination */
      private Map producers = new HashMap();

      ///** A Map of Queue or Topic Requestors indexed by Destination */
      //private Map requestors = new HashMap();
      private ThreadLocal requestorsMap = new ThreadLocal() {
          protected Object initialValue() {
              return new HashMap();
          }
      };

      /** The inbox which is used for the call() methods */
      private Destination replyToDestination;


      public MessengerSupport() {
      }

      public String toString() {
          try {
              Session session = borrowSession();
              String answer = super.toString() + " session: " + session.toString();
              returnSession( session );
              return answer;
          }
          catch (Exception e) {
              return super.toString() + " session: " + e.toString();
          }
      }

      public Destination getDestination(String subject) throws JMSException {
          Session session = borrowSession();
          try {
              if ( isTopic ( session ) ) {
                  return getTopic( (TopicSession) session, subject );
              }
              else {
                  return getQueue( (QueueSession) session, subject );
              }
          }
          finally {
              returnSession( session );
          }
      }

      public Destination createTemporaryDestination() throws JMSException {
          Session session = borrowSession();
          try {
              if ( isTopic ( session ) ) {
                  TopicSession topicSession = (TopicSession) session;
                  return topicSession.createTemporaryTopic();
              }
              else {
                  QueueSession queueSession = (QueueSession) session;
                  return queueSession.createTemporaryQueue();
              }
          }
          finally {
              returnSession( session );
          }
      }

      public void send( Destination destination, Message message ) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              if ( isTopic(producer) ) {
                  ((TopicPublisher) producer).publish( message );
              }
              else {
                  ((QueueSender) producer).send( message );
              }
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      public Message call( Destination destination, Message message ) throws JMSException {
          Session session = borrowSession();
          try {
              if ( isTopic ( session ) ) {
                  TopicRequestor requestor = getTopicRequestor( (TopicSession) session, (Topic) destination );
                  return requestor.request( message );
              }
              else {
                  QueueRequestor requestor = getQueueRequestor( (QueueSession) session, (Queue) destination );
                  return requestor.request( message );
              }
          }
          finally {
              returnSession( session );
          }
      }

  /*
      public Message call( Destination destination, Message message ) throws JMSException {
          Session session = borrowSession();
          try {
              Destination replyTo = getReplyToDestination();
              message.setJMSReplyTo(replyTo);

              MessageProducer producer = getMessageProducer( session, destination );
              MessageConsumer consumer = getMessageConsumer( session, replyTo );

              if ( isTopic ( session ) ) {
                  ((TopicPublisher) producer).publish( message );
              }
              else {
                  ((QueueSender) producer).send( message );
              }
              return consumer.receive();
          }
          finally {
              returnSession( session );
          }
      }
  */

      public Message call( Destination destination, Message message, long timeoutMillis ) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          MessageConsumer consumer = null;
          try {
              Destination replyTo = getReplyToDestination();
              message.setJMSReplyTo(replyTo);

              producer = getMessageProducer( session, destination );
              consumer = getMessageConsumer( session, replyTo );

              if ( isTopic ( session ) ) {
                  ((TopicPublisher) producer).publish( message );
              }
              else {
                  ((QueueSender) producer).send( message );
              }
              return consumer.receive(timeoutMillis);
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      public Message receive(Destination destination) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination );
              return consumer.receive();
          }
          finally {
              returnSession( session );
          }
      }

      public Message receive(Destination destination, String selector) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination, selector );
              return consumer.receive();
          }
          finally {
              returnSession( session );
          }
      }

      public Message receive(Destination destination, long timeoutMillis) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination );
              return consumer.receive(timeoutMillis);
          }
          finally {
              returnSession( session );
          }
      }

      public Message receive(Destination destination, String selector, long timeoutMillis) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination, selector );
              return consumer.receive(timeoutMillis);
          }
          finally {
              returnSession( session );
          }
      }

      public Message receiveNoWait(Destination destination) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination );
              return consumer.receiveNoWait();
          }
          finally {
              returnSession( session );
          }
      }

      public Message receiveNoWait(Destination destination, String selector) throws JMSException {
          Session session = borrowSession();
          try {
              MessageConsumer consumer = getMessageConsumer( session, destination, selector );
              return consumer.receiveNoWait();
          }
          finally {
              returnSession( session );
          }
      }

      public MessageConsumer createConsumer(Destination destination) throws JMSException {
          Session session = borrowSession();
          try {
              return createMessageConsumer( session, destination );
          }
          finally {
              returnSession( session );
          }
      }

      public MessageConsumer createConsumer(Destination destination, String selector) throws JMSException {
          Session session = borrowSession();
          try {
              return createMessageConsumer( session, destination, selector );
          }
          finally {
              returnSession( session );
          }
      }

      public void run() {
          // don't return sessions which throw an exception
          try {
              Session session = borrowSession();
              session.run();
              returnSession( session );
          }
          catch (JMSException e) {
              // ### ignore
          }
      }

      public ConnectionConsumer createConnectionConsumer(Destination destination, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
          return createConnectionConsumer(destination, null, sessionPool, maxMessages);
      }

      public ConnectionConsumer createConnectionConsumer(Destination destination, String selector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
          Connection connection = getConnection();
          if ( isTopic ( connection ) ) {
              TopicConnection topicConnection = (TopicConnection) connection;
              if ( isDurable() ) {
                  return topicConnection.createDurableConnectionConsumer( (Topic) destination, getDurableName(), selector, sessionPool, maxMessages );
              }
              else {
                  return topicConnection.createConnectionConsumer( (Topic) destination, selector, sessionPool, maxMessages );
              }
          }
          else {
              QueueConnection queueConnection = (QueueConnection) connection;
              return queueConnection.createConnectionConsumer( (Queue) destination, selector, sessionPool, maxMessages );
          }
      }

      public abstract Connection getConnection() throws JMSException;

      // Listener API
      //-------------------------------------------------------------------------

      public void addListener(Destination destination, MessageListener listener) throws JMSException {
          if ( listener instanceof MessengerListener ) {
              MessengerListener messengerListener = (MessengerListener) listener;
              messengerListener.setMessenger( this );
          }
          Session session = borrowListenerSession();
          try {
              MessageConsumer consumer = createMessageConsumer( session, destination );
              consumer.setMessageListener( listener );

              ListenerKey key = new ListenerKey( destination, listener );
              listeners.put( key, consumer );
          }
          finally {
              returnListenerSession( session );
          }
      }

      public void addListener(Destination destination, String selector, MessageListener listener) throws JMSException {
          if ( listener instanceof MessengerListener ) {
              MessengerListener messengerListener = (MessengerListener) listener;
              messengerListener.setMessenger( this );
          }
          Session session = borrowListenerSession();
          try {
              MessageConsumer consumer = createMessageConsumer( session, destination, selector );
              consumer.setMessageListener( listener );

              ListenerKey key = new ListenerKey( destination, listener, selector );
              listeners.put( key, consumer );
          }
          finally {
              returnListenerSession( session );
          }
      }


      public void removeListener(Destination destination, MessageListener listener ) throws JMSException {
          ListenerKey key = new ListenerKey( destination, listener );
          MessageConsumer consumer = (MessageConsumer) listeners.remove( key );
          if ( consumer == null ) {
              throw new JMSException( "The given listener object has not been added for the given destination" );
          }
          consumer.close();
      }

      public void removeListener(Destination destination, String selector, MessageListener listener ) throws JMSException {
          ListenerKey key = new ListenerKey( destination, listener, selector );
          MessageConsumer consumer = (MessageConsumer) listeners.remove( key );
          if ( consumer == null ) {
              throw new JMSException( "The given listener object has not been added for the given destination and selector" );
          }
          consumer.close();
      }


      // Message factory methods
      //-------------------------------------------------------------------------

      public BytesMessage createBytesMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createBytesMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public MapMessage createMapMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createMapMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public Message createMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public ObjectMessage createObjectMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createObjectMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
          Session session = borrowSession();
          try {
              return session.createObjectMessage(object);
          }
          finally {
              returnSession( session );
          }
      }

      public StreamMessage createStreamMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createStreamMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public TextMessage createTextMessage() throws JMSException {
          Session session = borrowSession();
          try {
              return session.createTextMessage();
          }
          finally {
              returnSession( session );
          }
      }

      public TextMessage createTextMessage(String text) throws JMSException {
          Session session = borrowSession();
          try {
              return session.createTextMessage(text);
          }
          finally {
              returnSession( session );
          }
      }

      public void commit() throws JMSException {
          Session session = borrowSession();
          try {
              session.commit();
          }
          finally {
              returnSession( session );
          }
      }

      public void rollback() throws JMSException {
          Session session = borrowSession();
          try {
              session.rollback();
          }
          finally {
              returnSession( session );
          }
      }

      public void close() throws JMSException {
          getConnection().close();
      }

      // Properties
      //-------------------------------------------------------------------------

      /** Gets the name that this Messenger is called in a MessengerManager */
      public String getName() {
          return name;
      }

      /** Sets the name that this Messenger is called in a MessengerManager */
      public void setName(String name) {
          this.name = name;
      }

      /** Gets whether topic subscribers are durable or not */
      public boolean isDurable() {
          return noLocal;
      }

      /** Sets whether topic subscribers are durable or not */
      public void setDurable(boolean durable) {
          this.durable = durable;
      }

      /** Returns the durable name used for durable topic based subscriptions */
      public String getDurableName() {
          return durableName;
      }

      /** Sets the durable name used for durable topic based subscriptions */
      public void setDurableName(String durableName) {
          this.durableName = durableName;
      }

      /** Gets whether local messages are ignored when topic based subscription is used
       * with a message selector */
      public boolean isNoLocal() {
          return noLocal;
      }

      /** Sets whether local messages are ignored when topic based subscription is used
       * with a message selector */
      public void setNoLocal(boolean noLocal) {
          this.noLocal = noLocal;
      }

      // Implementation methods
      //-------------------------------------------------------------------------


      /** Borrows a session instance from the pool */
      protected abstract Session borrowSession() throws JMSException;

      /** Returns a session instance back to the pool */
      protected abstract void returnSession(Session session) throws JMSException;

      /** Deletes a session instance */
      protected abstract void deleteSession(Session session) throws JMSException;

      /** Borrows a session instance from the pool */
      protected abstract Session borrowListenerSession() throws JMSException;

      /** Returns a session instance back to the pool */
      protected abstract void returnListenerSession(Session session) throws JMSException;

  //TAKO CHANGES START

      protected abstract boolean isTopic(Connection connection) throws JMSException;
      protected abstract boolean isTopic(ConnectionFactory factory) throws JMSException;
      protected abstract boolean isTopic(Session session) throws JMSException;
      protected abstract boolean isTopic(MessageProducer producer) throws JMSException;

      /** Get the producer's default delivery mode. */
      public int getDeliveryMode(Destination destination)  throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          int deliveryMode = 0;
          try {
              producer = getMessageProducer( session, destination );
              deliveryMode = producer.getDeliveryMode( );
          }
          finally {
              producer.close();
              returnSession( session );
          }
          return deliveryMode;
      }

      /** Set the producer's default delivery mode. */
      public void setDeliveryMode(Destination destination, int deliveryMode)  throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              producer.setDeliveryMode( deliveryMode );
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }
      /**  Get the producer's default priority. */
      public int getPriority(Destination destination ) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          int priority = 0;
          try {
              producer = getMessageProducer( session, destination );
              priority = producer.getPriority( );
          }
          finally {
              producer.close();
              returnSession( session );
          }
          return priority;
      }

      /**   Set the producer's default priority. */
      public void setPriority(Destination destination, int priority ) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              producer.setPriority( priority );
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      /**  Get the producer's default delivery mode. */
      public long getTimeToLive(Destination destination ) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          long timeToLive = 0;
          try {
              producer = getMessageProducer( session, destination );
              timeToLive = producer.getTimeToLive( );
          }
          finally {
              producer.close();
              returnSession( session );
          }
          return timeToLive;
      }

      /**  <p>Set the default length of time in milliseconds from its dispatch time that
       *   a produced message should be retained by the message system.</p>
       */
      public void setTimeToLive(Destination destination, long timeToLive) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;

          try {
              producer = getMessageProducer( session, destination );
              producer.setTimeToLive( timeToLive );
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      /** Get an indication of whether message timestamps are disabled. */
      public boolean getDisableMessageTimestamp(Destination destination)  throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          boolean value = false;
          try {
              producer = getMessageProducer( session, destination );
              value = producer.getDisableMessageTimestamp( );
          }
          finally {
              producer.close();
              returnSession( session );
          }
          return value;
      }

      /** Set whether message timestamps are disabled. */
      public void setDisableMessageTimestamp(Destination destination, boolean value) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              producer.setDisableMessageTimestamp( value );
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      /** Extends the send capability to send by specifying additional options. */
      public void send( Destination destination, Message message , int deliveryMode, int priority, long timeToLive) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              if ( isTopic(producer) ) {
                  ((TopicPublisher) producer).publish( message, deliveryMode, priority, timeToLive );
              }
              else {
                  ((QueueSender) producer).send( message, deliveryMode, priority, timeToLive);
              }
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }

      /**  Get an indication of whether message IDs are disabled. */
      public boolean getDisableMessageID(Destination destination)  throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          boolean value = false;
          try {
              producer = getMessageProducer( session, destination );
              value = producer.getDisableMessageID( );
          }
          finally {
              producer.close();
              returnSession( session );
          }
          return value;
      }

      /** Set whether message IDs are disabled. */
      public void setDisableMessageID(Destination destination, boolean value) throws JMSException {
          Session session = borrowSession();
          MessageProducer producer = null;
          try {
              producer = getMessageProducer( session, destination );
              producer.setDisableMessageID( value );
          }
          finally {
              producer.close();
              returnSession( session );
          }
      }



  //TAKO CHANGES END

      /** Returns a message producer for the given session and destination */
      protected MessageProducer getMessageProducer( Session session, Destination destination ) throws JMSException {
          return createMessageProducer( session, destination );
  /**
          MessageProducer producer = (MessageProducer) producers.get( destination );
          if ( producer == null ) {
              producer = createMessageProducer( session, destination );
          }
          return producer;
  */
      }

      /** Returns a newly created message producer for the given session and destination */
      protected MessageProducer createMessageProducer( Session session, Destination destination ) throws JMSException {
          if ( isTopic ( session ) ) {
              TopicSession topicSession = (TopicSession) session;
              return topicSession.createPublisher( (Topic) destination );
          }
          else {
              QueueSession queueSession = (QueueSession) session;
              return queueSession.createSender( (Queue) destination );
          }
      }

      /** Returns a MessageConsumer for the given session and destination */
      protected MessageConsumer getMessageConsumer( 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;
  */
      }

      /** Returns a MessageConsumer for the given session, destination and selector */
      protected MessageConsumer getMessageConsumer( Session session, Destination destination, String selector ) throws JMSException {
          // XXXX: could do caching one day
          return createMessageConsumer( session, destination, selector );
      }

      /** Returns a new MessageConsumer for the given session and destination */
      protected MessageConsumer createMessageConsumer( Session session, Destination destination ) throws JMSException {
          if ( isTopic ( session ) ) {
              TopicSession topicSession = (TopicSession) session;
              if ( isDurable() ) {
                  return topicSession.createDurableSubscriber(
                      (Topic) destination,
                      getDurableName()
                  );
              }
              else {
                  return topicSession.createSubscriber(
                      (Topic) destination
                  );
              }
          }
          else {
              QueueSession queueSession = (QueueSession) session;
              return queueSession.createReceiver( (Queue) destination );
          }
      }

      /** Returns a new MessageConsumer for the given session, destination and selector */
      protected MessageConsumer createMessageConsumer( Session session, Destination destination, String selector ) throws JMSException {
          if ( isTopic ( session ) ) {
              TopicSession topicSession = (TopicSession) session;
              if ( isDurable() ) {
                  return topicSession.createDurableSubscriber(
                      (Topic) destination,
                      getDurableName(),
                      selector,
                      isNoLocal()
                  );
              }
              else {
                  return topicSession.createSubscriber(
                      (Topic) destination,
                      selector,
                      isNoLocal()
                  );
              }
          }
          else {
              QueueSession queueSession = (QueueSession) session;
              return queueSession.createReceiver(
                  (Queue) destination,
                  selector
              );
          }
      }

      protected Queue getQueue(QueueSession session, String subject) throws JMSException {
          // XXXX: might want to cache
          return session.createQueue( subject );
      }

      protected Topic getTopic(TopicSession session, String subject) throws JMSException {
          // XXXX: might want to cache
          return session.createTopic( subject );
      }

      protected Destination getReplyToDestination() throws JMSException {
          if ( replyToDestination == null ) {
              replyToDestination = createTemporaryDestination();
          }
          return replyToDestination;
      }

      protected TopicRequestor getTopicRequestor( TopicSession session, Topic destination ) throws JMSException {
          if ( CACHE_REQUESTOR ) {
              Map requestors = (Map) requestorsMap.get();
              TopicRequestor requestor = (TopicRequestor) requestors.get( destination );
              if ( requestor == null ) {
                  requestor = new TopicRequestor( session, destination );
                  requestors.put( destination, requestor );
              }
              return requestor;
          }
          else {
              return new TopicRequestor( session, destination );
          }
      }

      protected QueueRequestor getQueueRequestor( QueueSession session, Queue destination ) throws JMSException {
          if ( CACHE_REQUESTOR ) {
              Map requestors = (Map) requestorsMap.get();
              QueueRequestor requestor = (QueueRequestor) requestors.get( destination );
              if ( requestor == null ) {
                  requestor = new QueueRequestor( session, destination );
                  requestors.put( destination, requestor );
              }
              return requestor;
          }
          else {
              return new QueueRequestor( session, destination );
          }
      }

  }




------------------------------------------------------------------------------


  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: DefaultMessenger.java,v 1.6 2001/10/25 21:07:12 jstrachan Exp $
   */
  package org.apache.commons.messenger;

  import java.lang.ThreadLocal; // for javadoc
  import java.io.Serializable;

  import javax.jms.Connection;
  import javax.jms.ConnectionFactory;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.jms.MessageListener;
  import javax.jms.MessageProducer;
  import javax.jms.ServerSessionPool;
  import javax.jms.Session;
  import javax.jms.ConnectionFactory;
  import javax.jms.Queue;
  import javax.jms.QueueConnection;
  import javax.jms.QueueRequestor;
  import javax.jms.QueueSender;
  import javax.jms.QueueSession;
  import javax.jms.Topic;
  import javax.jms.TopicConnection;
  import javax.jms.TopicPublisher;
  import javax.jms.TopicRequestor;
  import javax.jms.TopicSession;

  /** <p><code>DefaultMessenger</code> is the default implementation of 
    * Messenger which uses a {@link ThreadLocal} variable
    * to keep the JMS Session that should be used for a given calling thread.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.6 $
    */
  public class DefaultMessenger extends MessengerSupport {

      private static final boolean SHARE_CONNECTION = true;
      private static final boolean USE_SESSIONFACTORY_FOR_FINDING_DESTINATION = true;
      
      /** the session object for each thread */
      private ThreadLocal sessionPool = new ThreadLocal();
      /** the listener session object for each thread */
      private ThreadLocal listenerSessionPool = new ThreadLocal();
      /** The factory used to create each thread's JMS Session */
      private SessionFactory sessionFactory;
      /** A pool of Connections, one per thread */
      private ThreadLocal connectionPool = new ThreadLocal();
      
      public DefaultMessenger() {
      }

      /** Checks if a connection is associated with a Topic */
      protected boolean isTopic(Connection connection)  throws JMSException {
          return getSessionFactory().isTopic(connection);
      }

      /** Checks if the factory is associated with a Topic */
      protected boolean isTopic(ConnectionFactory factory)  throws JMSException {
          return getSessionFactory().isTopic(factory);
      }

      /** Checks if the session is associated with a Topic */
      protected boolean isTopic(Session session) throws JMSException {
          return getSessionFactory().isTopic(session);
      }

      /** Checks if the producer is associated with a Topic */
      protected boolean isTopic(MessageProducer producer) throws JMSException {
          return getSessionFactory().isTopic(producer);
      }

      /** Provides users the option of marking a SessionFactory to function for a Topic or a Queue.*/
      public void setIsTopic(boolean isTopic) throws JMSException {
          getSessionFactory().setIsTopic(isTopic);
      }

      /** Enables users to identify if the factory is associated with a Queue or a Topic */
      public boolean getIsTopic ()  throws JMSException {
          return getSessionFactory().getIsTopic();
      }

      /** Returns the SessionFactory used to create new JMS sessions */
      public SessionFactory getSessionFactory() throws JMSException {
          if ( sessionFactory == null ) {
              sessionFactory = createSessionFactory();
          }
          return sessionFactory;
      }
      
      /** Sets the SessionFactory used to create new JMS sessions */
      public void setSessionFactory(SessionFactory sessionFactory) {
          this.sessionFactory = sessionFactory;
      }
         
      
      public Connection getConnection() throws JMSException {
          if ( SHARE_CONNECTION ) {
              return getSessionFactory().getConnection();
          }
          else {
              Connection answer = (Connection) connectionPool.get();
              if ( answer == null ) {
                  answer = getSessionFactory().createConnection();
                  
                  System.out.println( "Created connection: " + answer + " for thread: " + Thread.currentThread() );
                  
                  connectionPool.set( answer );
              }
              return answer;
          }
      }
      
      public ServerSessionPool createServerSessionPool(MessageListener messageListener, int maxThreads) throws JMSException {
          return getSessionFactory().createServerSessionPool(messageListener, maxThreads);
      }
      
      public void close() throws JMSException {        
          getSessionFactory().close();
          
          // clear all the pools...
          sessionPool = new ThreadLocal();
          listenerSessionPool = new ThreadLocal();
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------        
      protected Session borrowSession() throws JMSException {
          Session answer = (Session) sessionPool.get();
          if ( answer == null ) {
              answer = createSession();
              sessionPool.set( answer );
          }
          return answer;
      }
      
      protected void returnSession(Session session) {
      }
      
      protected void deleteSession(Session session) throws JMSException {
          sessionPool.set( null);
      }
      
      protected Session borrowListenerSession() throws JMSException {
          Session answer = (Session) listenerSessionPool.get();
          if ( answer == null ) {
              answer = createSession();
              listenerSessionPool.set( answer );
          }
          return answer;
      }
      
      protected void returnListenerSession(Session session) throws JMSException {
      }
      
      /** Factory method to create a new JMS Session */
      protected Session createSession() throws JMSException {
          return getSessionFactory().createSession( getConnection() );
      }
      
      /** Factory method to create a SessionFactory. 
        * Derived classes could override this method to create the SessionFactory
        * from a well known place
        */
      protected SessionFactory createSessionFactory() throws JMSException {
          throw new JMSException( "No SessionFactory configured for this Messenger. Cannot create a new JMS Session" );
      }

      /**
       * Over-rides the default getQueue mechanism from MessengerSupport
       */
      protected Queue getQueue(QueueSession session, String subject) throws JMSException {
          if ( USE_SESSIONFACTORY_FOR_FINDING_DESTINATION ) {
              return (Queue)getSessionFactory().getDestination(subject);
          }
          else {
              return super.getQueue(session,subject);
          }
      }

      /**
       * Over-rides the default getTopic mechanism from MessengerSupport
       */
      protected Topic getTopic(TopicSession session, String subject) throws JMSException {
          if ( USE_SESSIONFACTORY_FOR_FINDING_DESTINATION ) {
              return (Topic)getSessionFactory().getDestination(subject);
          }
          else {
              return super.getTopic(session, subject);
          }
      }
  }





------------------------------------------------------------------------------


  --
  To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
  For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message