org.objectweb.jonas_ejb.container
Class JSessionSwitch

java.lang.Object
  |
  +--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 ans 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 local
           
protected  TimerEvent mytimer
           
protected  JSessionRemote remote
           
 
Constructor Summary
JSessionSwitch(JSessionFactory bf)
          constructor. a new object is build when the pool managed by JSessionFactory becomes empty.
 
Method Summary
 JSessionFactory getBeanFactory()
           
abstract  JSessionContext getICtx(javax.transaction.Transaction tx)
           
 JSessionLocal getLocal()
           
 JSessionRemote getRemote()
           
abstract  void releaseICtx(javax.transaction.Transaction tx)
           
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

local

protected JSessionLocal local

remote

protected JSessionRemote remote

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
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 seconds 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

releaseICtx

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

setMustCommit

public abstract void setMustCommit(boolean mc)