Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.ra
Class ServerSessionImpl  view ServerSessionImpl download ServerSessionImpl.java

java.lang.Object
  extended byorg.activemq.ra.ServerSessionImpl
All Implemented Interfaces:
org.activemq.ActiveMQSession.DeliveryListener, java.lang.Runnable, javax.jms.ServerSession, SessionAndProducer, javax.resource.spi.work.Work

public class ServerSessionImpl
extends java.lang.Object
implements javax.jms.ServerSession, SessionAndProducer, javax.resource.spi.work.Work, org.activemq.ActiveMQSession.DeliveryListener

Version:
$Revision: 1.1.1.1 $

Field Summary
private  int batchSize
          The maximum number of messages to batch
private  int currentBatchSize
          The current number of messages in the batch
private  javax.resource.spi.endpoint.MessageEndpoint endpoint
           
private  org.apache.commons.logging.Log log
           
private  javax.jms.MessageProducer messageProducer
           
private static int nextLogId
           
static java.lang.reflect.Method ON_MESSAGE_METHOD
           
private  ServerSessionPoolImpl pool
           
private  java.lang.Object runControlMutex
           
private  boolean runningFlag
           
private  int serverSessionId
           
private  org.activemq.ActiveMQSession session
           
private  boolean stale
          True if an error was detected that cause this session to be stale.
private  boolean useRAManagedTx
          Does the TX commit need to be managed by the RA?
private  javax.resource.spi.work.WorkManager workManager
           
 
Constructor Summary
ServerSessionImpl(ServerSessionPoolImpl pool, org.activemq.ActiveMQSession session, javax.resource.spi.work.WorkManager workManager, javax.resource.spi.endpoint.MessageEndpoint endpoint, boolean useRAManagedTx, int batchSize)
           
 
Method Summary
 void afterDelivery(org.activemq.ActiveMQSession session, javax.jms.Message msg)
          The ActiveMQSession's run method will call back to this method after dispactching a message to the MessageListener.
 void beforeDelivery(org.activemq.ActiveMQSession session, javax.jms.Message msg)
          The ActiveMQSession's run method will call back to this method before dispactching a message to the MessageListener.
 void close()
           
 javax.jms.MessageProducer getMessageProducer()
          Lazily creates a message producer that can be used to send messages using the same JMS Session which is being used to dispatch messages which minimises the XA overheard of consuming and producing or allows JMS transactions to be used for consuming and producing messages.
private static int getNextLogId()
           
 javax.jms.Session getSession()
          Returns the current session being used to process a JMS message in the current thread.
 void release()
           
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 void start()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ON_MESSAGE_METHOD

public static final java.lang.reflect.Method ON_MESSAGE_METHOD

nextLogId

private static int nextLogId

serverSessionId

private int serverSessionId

log

private final org.apache.commons.logging.Log log

session

private org.activemq.ActiveMQSession session

workManager

private javax.resource.spi.work.WorkManager workManager

endpoint

private javax.resource.spi.endpoint.MessageEndpoint endpoint

messageProducer

private javax.jms.MessageProducer messageProducer

pool

private final ServerSessionPoolImpl pool

runControlMutex

private java.lang.Object runControlMutex

runningFlag

private boolean runningFlag

stale

private boolean stale
True if an error was detected that cause this session to be stale. When a session is stale, it should not be used again for proccessing.


useRAManagedTx

private final boolean useRAManagedTx
Does the TX commit need to be managed by the RA?


batchSize

private final int batchSize
The maximum number of messages to batch


currentBatchSize

private int currentBatchSize
The current number of messages in the batch

Constructor Detail

ServerSessionImpl

public ServerSessionImpl(ServerSessionPoolImpl pool,
                         org.activemq.ActiveMQSession session,
                         javax.resource.spi.work.WorkManager workManager,
                         javax.resource.spi.endpoint.MessageEndpoint endpoint,
                         boolean useRAManagedTx,
                         int batchSize)
                  throws javax.jms.JMSException
Method Detail

getNextLogId

private static int getNextLogId()

getSession

public javax.jms.Session getSession()
                             throws javax.jms.JMSException
Description copied from interface: SessionAndProducer
Returns the current session being used to process a JMS message in the current thread.

Specified by:
getSession in interface javax.jms.ServerSession

getMessageProducer

public javax.jms.MessageProducer getMessageProducer()
                                             throws javax.jms.JMSException
Description copied from interface: SessionAndProducer
Lazily creates a message producer that can be used to send messages using the same JMS Session which is being used to dispatch messages which minimises the XA overheard of consuming and producing or allows JMS transactions to be used for consuming and producing messages.

Specified by:
getMessageProducer in interface SessionAndProducer

start

public void start()
           throws javax.jms.JMSException
Specified by:
start in interface javax.jms.ServerSession

run

public void run()
Description copied from interface: java.lang.Runnable
This method will be called by whoever wishes to run your class implementing Runnable. Note that there are no restrictions on what you are allowed to do in the run method, except that you cannot throw a checked exception.

Specified by:
run in interface java.lang.Runnable

beforeDelivery

public void beforeDelivery(org.activemq.ActiveMQSession session,
                           javax.jms.Message msg)
The ActiveMQSession's run method will call back to this method before dispactching a message to the MessageListener.

Specified by:
beforeDelivery in interface org.activemq.ActiveMQSession.DeliveryListener

afterDelivery

public void afterDelivery(org.activemq.ActiveMQSession session,
                          javax.jms.Message msg)
The ActiveMQSession's run method will call back to this method after dispactching a message to the MessageListener.

Specified by:
afterDelivery in interface org.activemq.ActiveMQSession.DeliveryListener

release

public void release()
Specified by:
release in interface javax.resource.spi.work.Work

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


close

public void close()