Coverage Report - org.apache.commons.messenger.DefaultServerSession
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultServerSession
0%
0/11
0%
0/2
1.25
 
 1  
 /*
 2  
  * Copyright (C) The Apache Software Foundation. All rights reserved.
 3  
  *
 4  
  * This software is published under the terms of the Apache Software License
 5  
  * version 1.1, a copy of which has been included with this distribution in
 6  
  * the LICENSE file.
 7  
  * 
 8  
  * $Id: DefaultServerSession.java 155459 2005-02-26 13:24:44Z dirkv $
 9  
  */
 10  
 package org.apache.commons.messenger;
 11  
 
 12  
 import javax.jms.JMSException;
 13  
 import javax.jms.ServerSession;
 14  
 import javax.jms.Session;
 15  
 
 16  
 
 17  
 /** <p><code>DefaultServerSession</code> is a default implementation of
 18  
   * the JMS ServerSession interface.</p>
 19  
   *
 20  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 21  
   * @version $Revision: 155459 $
 22  
   */
 23  
 public class DefaultServerSession extends Thread implements ServerSession {
 24  
 
 25  
     /** The JMS Session on which this ServerSession is based */
 26  
     private Session session;
 27  
     /** Indicates whether the session has been started */
 28  0
     private boolean started = false;
 29  
     
 30  0
     public DefaultServerSession(Session session) throws JMSException {
 31  0
         this.session = session;
 32  0
     }
 33  
 
 34  
     /**
 35  
      * Return the ServerSession's Session. This must be a Session
 36  
      * created by the same Connection which will be dispatching messages
 37  
      * to it. The provider will assign one or more messages to the Session
 38  
      * and then call start on the ServerSession.
 39  
      *
 40  
      * @return the server session's session.
 41  
      *
 42  
      * @exception JMSException if a JMS error occurs.
 43  
      */
 44  
     public Session getSession() throws JMSException {
 45  0
         return session;
 46  
     }
 47  
 
 48  
     /** 
 49  
      * Cause the session's run method to be called to process messages
 50  
      * that were just assigned to it.
 51  
      *
 52  
      */
 53  
     public synchronized void start() {
 54  0
         if ( ! started  ) {
 55  0
             started = true;
 56  0
             super.start();
 57  
         }
 58  0
     }
 59  
 
 60  
     public void run() {
 61  0
         session.run();
 62  0
     }
 63  
 }
 64