org.jboss.jms.asf
Class StdServerSession

java.lang.Object
  extended byorg.jboss.jms.asf.StdServerSession
All Implemented Interfaces:
MessageListener (src) , java.lang.Runnable, ServerSession (src)

public class StdServerSession
extends java.lang.Object
implements java.lang.Runnable, ServerSession (src) , MessageListener (src)

An implementation of ServerSession.

Created: Thu Dec 7 18:25:40 2000


Method Summary
 Session (src) getSession()
          Returns the session.
 void onMessage(Message (src)  msg)
          Will get called from session for each message stuffed into it.
 void run()
          Runs in an own thread, basically calls the session.run(), it is up to the session to have been filled with messages and it will run against the listener set in StdServerSessionPool.
 void start()
          Start the session and begin consuming messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSession

public Session (src)  getSession()
                   throws JMSException (src) 
Returns the session.

This simply returns what it has fetched from the connection. It is up to the jms provider to typecast it and have a private API to stuff messages into it.

Specified by:
getSession in interface ServerSession (src)
Returns:
The session.
Throws:
JMSException (src) - Description of Exception

run

public void run()
Runs in an own thread, basically calls the session.run(), it is up to the session to have been filled with messages and it will run against the listener set in StdServerSessionPool. When it has send all its messages it returns.

Specified by:
run in interface java.lang.Runnable

onMessage

public void onMessage(Message (src)  msg)
Will get called from session for each message stuffed into it. Starts a transaction with the TransactionManager and enlists the XAResource of the JMS XASession if a XASession was available. A good JMS implementation should provide the XASession for use in the ASF. So we optimize for the case where we have an XASession. So, for the case where we do not have an XASession and the bean is not transacted, we have the unneeded overhead of creating a Transaction. I'm leaving it this way since it keeps the code simpler and that case should not be too common (JBossMQ provides XASessions).

Specified by:
onMessage in interface MessageListener (src)
Parameters:
msg - the message passed to the listener

start

public void start()
           throws JMSException (src) 
Start the session and begin consuming messages.

Specified by:
start in interface ServerSession (src)
Throws:
JMSException (src) - No listener has been specified.