com.atomikos.jms.extra
Class SingleThreadedJmsSenderTemplate

java.lang.Object
  extended by com.atomikos.jms.extra.AbstractJmsSenderTemplate
      extended by com.atomikos.jms.extra.SingleThreadedJmsSenderTemplate

public class SingleThreadedJmsSenderTemplate
extends AbstractJmsSenderTemplate

This is a long-lived JMS sender session, representing a self-refreshing JMS session that can be used to send JMS messages in a transacted way (a JTA transaction context is required). The client code does not have to worry about refreshing or closing JMS objects explicitly: this is all handled in this class. All the client needs to do is indicate when it wants to start or stop using the session.

Note that instances are not meant for concurrent use by different threads: threaded applications should use the ConcurrentJmsSenderTemplate instead.

Important: if you change any properties AFTER sending on the session, then you will need to explicitly stop and restart the session to have the changes take effect!


Field Summary
 
Fields inherited from class com.atomikos.jms.extra.AbstractJmsSenderTemplate
connectionFactoryBean, destination, inited, password
 
Constructor Summary
SingleThreadedJmsSenderTemplate()
           
 
Method Summary
protected  void afterUseWithoutErrors(javax.jms.Connection c, javax.jms.Session s)
           
protected  void afterUseWithoutErrors(javax.jms.Session session)
           
protected  void destroy(javax.jms.Connection c, javax.jms.Session s)
           
protected  javax.jms.Session getOrRefreshSession(javax.jms.Connection c)
           
protected  javax.jms.Connection getOrReuseConnection()
           
 String toString()
           
 
Methods inherited from class com.atomikos.jms.extra.AbstractJmsSenderTemplate
close, executeCallback, executeCallbackInternal, getAtomikosConnectionFactoryBean, getDeliveryMode, getDestination, getDestinationName, getPriority, getReplyToDestination, getReplyToDestinationName, getTimeToLive, getUser, init, refreshConnection, sendBytesMessage, sendMapMessage, sendObjectMessage, sendTextMessage, setAtomikosConnectionFactoryBean, setDeliveryMode, setDestination, setDestinationName, setPassword, setPriority, setReplyToDestination, setReplyToDestinationName, setTimeToLive, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SingleThreadedJmsSenderTemplate

public SingleThreadedJmsSenderTemplate()
Method Detail

getOrRefreshSession

protected javax.jms.Session getOrRefreshSession(javax.jms.Connection c)
                                         throws javax.jms.JMSException
Specified by:
getOrRefreshSession in class AbstractJmsSenderTemplate
Throws:
javax.jms.JMSException

toString

public String toString()
Overrides:
toString in class Object

afterUseWithoutErrors

protected void afterUseWithoutErrors(javax.jms.Session session)
                              throws javax.jms.JMSException
Throws:
javax.jms.JMSException

destroy

protected void destroy(javax.jms.Connection c,
                       javax.jms.Session s)
                throws javax.jms.JMSException
Specified by:
destroy in class AbstractJmsSenderTemplate
Throws:
javax.jms.JMSException

afterUseWithoutErrors

protected void afterUseWithoutErrors(javax.jms.Connection c,
                                     javax.jms.Session s)
                              throws javax.jms.JMSException
Specified by:
afterUseWithoutErrors in class AbstractJmsSenderTemplate
Throws:
javax.jms.JMSException

getOrReuseConnection

protected javax.jms.Connection getOrReuseConnection()
                                             throws javax.jms.JMSException
Specified by:
getOrReuseConnection in class AbstractJmsSenderTemplate
Throws:
javax.jms.JMSException


Copyright © 2011. All Rights Reserved.