org.objectweb.jonas_ejb.container
Class JStatefulSwitch

java.lang.Object
  extended byorg.objectweb.jonas_ejb.container.JSessionSwitch
      extended byorg.objectweb.jonas_ejb.container.JStatefulSwitch
All Implemented Interfaces:
TimerEventListener

public class JStatefulSwitch
extends JSessionSwitch

JStatefulSwitch is the implementation of JSessionSwitch dedicated to the Stateful Session Bean.

Author:
Philippe Durieux

Field Summary
 
Fields inherited from class org.objectweb.jonas_ejb.container.JSessionSwitch
bf, local, mytimer, remote
 
Constructor Summary
JStatefulSwitch(JStatefulFactory bf, JStatefulPool sfp)
          constructor.
 
Method Summary
 void bindICtx(javax.transaction.Transaction tx, JStatefulContext bctx)
          At each create, bind the Context to the transaction
 void delistConnections(javax.transaction.Transaction tx)
          delist all connections of the list
 void enlistConnections(javax.transaction.Transaction tx)
          enlist all connection of the list
 JSessionContext getICtx(javax.transaction.Transaction tx)
          At each business method, get a BeanContext to run it
 boolean isInTransaction()
          This is used for remove on stateful session beans only.
 void noLongerUsed()
          This Session is no longer used: - unexport Remote Object - return the Session in the pool
 void popConnectionList()
          save the current connectionList for future use (next preInvoke).
 void pushConnectionList()
          Set the connection list associated to the current thread with the list associated to this stateful session.
 void releaseICtx(javax.transaction.Transaction tx)
          Release the Context after use.
 void setConnectionList(java.util.List cl)
          Save the Connection List after a create method.
 void setMustCommit(boolean mc)
          set a flag to remember that the transaction must be committed
 void timeoutExpired(java.lang.Object arg)
          The session timeout has expired
 void txCompleted()
          End of Transaction
 
Methods inherited from class org.objectweb.jonas_ejb.container.JSessionSwitch
getBeanFactory, getLocal, getRemote, startTimer, stopTimer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JStatefulSwitch

public JStatefulSwitch(JStatefulFactory bf,
                       JStatefulPool sfp)
                throws java.rmi.RemoteException
constructor.

Parameters:
bf - The Bean Factory
Method Detail

pushConnectionList

public void pushConnectionList()
Set the connection list associated to the current thread with the list associated to this stateful session.

Specified by:
pushConnectionList in class JSessionSwitch

popConnectionList

public void popConnectionList()
save the current connectionList for future use (next preInvoke).

Specified by:
popConnectionList in class JSessionSwitch

setConnectionList

public void setConnectionList(java.util.List cl)
Save the Connection List after a create method.


enlistConnections

public void enlistConnections(javax.transaction.Transaction tx)
enlist all connection of the list

Specified by:
enlistConnections in class JSessionSwitch

delistConnections

public void delistConnections(javax.transaction.Transaction tx)
delist all connections of the list

Specified by:
delistConnections in class JSessionSwitch

timeoutExpired

public void timeoutExpired(java.lang.Object arg)
The session timeout has expired

Parameters:
arg - Not Used.

getICtx

public JSessionContext getICtx(javax.transaction.Transaction tx)
At each business method, get a BeanContext to run it

Specified by:
getICtx in class JSessionSwitch
Parameters:
tx - The Transaction Context
Returns:
The Session Context

bindICtx

public void bindICtx(javax.transaction.Transaction tx,
                     JStatefulContext bctx)
At each create, bind the Context to the transaction

Parameters:
tx - The current Transaction Context
bctx - The Context to bind

releaseICtx

public void releaseICtx(javax.transaction.Transaction tx)
Release the Context after use.

Specified by:
releaseICtx in class JSessionSwitch
Parameters:
tx - The current Transaction Context

noLongerUsed

public void noLongerUsed()
This Session is no longer used: - unexport Remote Object - return the Session in the pool


txCompleted

public void txCompleted()
End of Transaction


isInTransaction

public boolean isInTransaction()
This is used for remove on stateful session beans only.

Returns:
True if bean is participating in a client transaction

setMustCommit

public void setMustCommit(boolean mc)
set a flag to remember that the transaction must be committed

Specified by:
setMustCommit in class JSessionSwitch