commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger MessengerSupport.java
Date Wed, 26 Jun 2002 11:30:59 GMT
jstrachan    2002/06/26 04:30:59

  Modified:    messenger/src/java/org/apache/commons/messenger
                        MessengerSupport.java
  Log:
  Stopped using QueueRequestor and TopicRequestor in the call() method and now use our own
mechanism instead. 
  This allows us to reuse a temporary destination per thread as well as one day we could start
pooling MessageProducers or MessageConsumers.
  
  Revision  Changes    Path
  1.24      +17 -44    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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MessengerSupport.java	26 Jun 2002 11:07:22 -0000	1.23
  +++ MessengerSupport.java	26 Jun 2002 11:30:59 -0000	1.24
  @@ -143,57 +143,30 @@
               returnSession(session);
           }
       }
  -    
  -    public Message call(Destination destination, Message message)
  -        throws JMSException {
  +
  +    public Message call( Destination destination, Message message ) throws JMSException
{
           Session session = borrowSession();
  +        MessageConsumer consumer = null;
           try {
  -            if (isTopic(session)) {
  -                TopicRequestor requestor =
  -                    getMessengerSession().getTopicRequestor(
  -                        (TopicSession) session, (Topic) destination
  -                    );
  -                return requestor.request(message);
  +            Destination replyTo = getReplyToDestination();
  +            message.setJMSReplyTo(replyTo);
  +
  +            MessageProducer producer = getMessageProducer( session, destination );
  +            consumer = borrowMessageConsumer( session, replyTo );
  +
  +            if ( isTopic( session ) ) {
  +                ((TopicPublisher) producer).publish( message );
               }
               else {
  -                QueueRequestor requestor =
  -                    getMessengerSession().getQueueRequestor(
  -                        (QueueSession) session, (Queue) destination
  -                    );
  -                return requestor.request(message);
  +                ((QueueSender) producer).send( message );
               }
  +            return consumer.receive();
           }
           finally {
  -            returnSession(session);
  +            returnMessageConsumer(consumer);
  +            returnSession( session );
           }
       }
  -    
  -    /*
  -     * It'd be nice to try replacing the above with this...
  -     * 
  -        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 = borrowMessageConsumer( session, replyTo );
  -    
  -                if ( isTopic( session ) ) {
  -                    ((TopicPublisher) producer).publish( message );
  -                }
  -                else {
  -                    ((QueueSender) producer).send( message );
  -                }
  -                return consumer.receive();
  -            }
  -            finally {
  -                returnMessageConsumer(consumer);
  -                returnSession( session );
  -            }
  -        }
  -    */
       
       public Message call(
           Destination destination,
  
  
  

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


Mime
View raw message