org.objectweb.jonas_ejb.container
Class JSessionSwitch

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.JSessionSwitch
All Implemented Interfaces:
TimerEventListener
Direct Known Subclasses:
JStatefulSwitch, JStatelessSwitch

public abstract class JSessionSwitch
extends java.lang.Object
implements TimerEventListener

JSessionSwitch holds all the code that is common to EJBObject and EJBLocalObject for session beans. It mainly keep a reference on the SessionContext and is used to manage the timeout for the session. This class has 2 subclasses, depending if session is stateless or stateful.

Author:
Philippe Durieux

Field Summary
protected  JSessionFactory bf
           
protected  JSessionLocal mylocal
           
protected  JSessionRemote myremote
           
protected  TimerEvent mytimer
           
 
Constructor Summary
JSessionSwitch(JSessionFactory bf)
          constructor.
 
Method Summary
abstract  void delistConnections(javax.transaction.Transaction tx)
           
abstract  void enlistConnections(javax.transaction.Transaction tx)
           
 JSessionFactory getBeanFactory()
           
abstract  JSessionContext getICtx(javax.transaction.Transaction tx)
           
 JSessionLocal getLocal()
           
 JSessionRemote getRemote()
           
abstract  void noLongerUsed()
           
abstract  void popConnectionList()
           
abstract  void pushConnectionList()
           
abstract  void releaseICtx(RequestCtx req, boolean discard)
           
abstract  void saveBeanTx()
           
abstract  void setMustCommit(boolean mc)
           
 void startTimer(int timeout)
          Start a timer for this Session.
 void stopTimer()
          Stop the Timer associated to the Session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jonas_timer.TimerEventListener
timeoutExpired
 

Field Detail

bf

protected JSessionFactory bf

mylocal

protected JSessionLocal mylocal

myremote

protected JSessionRemote myremote

mytimer

protected TimerEvent mytimer
Constructor Detail

JSessionSwitch

public JSessionSwitch(JSessionFactory bf)
               throws java.rmi.RemoteException
constructor. a new object is build when the pool managed by JSessionFactory becomes empty.

Parameters:
bf - The Bean Factory
Throws:
java.rmi.RemoteException
Method Detail

getLocal

public JSessionLocal getLocal()
Returns:
the underlaying EJBLocalObject

getRemote

public JSessionRemote getRemote()
Returns:
the underlaying EJBObject

getBeanFactory

public JSessionFactory getBeanFactory()
Returns:
the BeanFactory

startTimer

public void startTimer(int timeout)
Start a timer for this Session.

Parameters:
timeout - nb of milliseconds max this Session should live.

stopTimer

public void stopTimer()
Stop the Timer associated to the Session


getICtx

public abstract JSessionContext getICtx(javax.transaction.Transaction tx)
                                 throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

releaseICtx

public abstract void releaseICtx(RequestCtx req,
                                 boolean discard)

setMustCommit

public abstract void setMustCommit(boolean mc)

saveBeanTx

public abstract void saveBeanTx()

pushConnectionList

public abstract void pushConnectionList()

popConnectionList

public abstract void popConnectionList()

enlistConnections

public abstract void enlistConnections(javax.transaction.Transaction tx)

delistConnections

public abstract void delistConnections(javax.transaction.Transaction tx)

noLongerUsed

public abstract void noLongerUsed()