站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

StdServerSession (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.jms.asf
Class StdServerSession

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

public class StdServerSession
extends Object
implements Runnable, javax.jms.ServerSession, javax.jms.MessageListener

An implementation of ServerSession.

Created: Thu Dec 7 18:25:40 2000

Version:
$Revision: 1.18 $
Author:
Peter Antman ., Jason Dillon, Hiram Chirino .

Method Summary
 javax.jms.Session getSession()
          Returns the session.
 void onMessage(javax.jms.Message 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 javax.jms.Session getSession()
                             throws javax.jms.JMSException
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 javax.jms.ServerSession
Returns:
The session.
Throws:
javax.jms.JMSException - 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 Runnable

onMessage

public void onMessage(javax.jms.Message 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 javax.jms.MessageListener

start

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

Specified by:
start in interface javax.jms.ServerSession
Throws:
javax.jms.JMSException - No listener has been specified.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.