org.objectweb.jonas_ejb.container
Class JEntitySwitchDB

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.JEntitySwitch
      extended by org.objectweb.jonas_ejb.container.JEntitySwitchDB

public class JEntitySwitchDB
extends JEntitySwitch

DataBase lock policy : 1 instance per transactions. Transaction Isolation is managed by the database.

Author:
Philippe Durieux

Field Summary
protected  JEntityContext ihContext
          EntityContext for non-transacted requests
protected  java.util.HashMap itsContext
          Map of EntityContext's for transactions Key is the Transaction.
 
Fields inherited from class org.objectweb.jonas_ejb.container.JEntitySwitch
bf, blockedtx, counter, countIH, countIT, deadlockTimeout, estimestamp, FEW_SECONDS, ident, inactivityTimeout, inDirtyList, isdetached, isremoved, lazyregister, local, lockpolicy, mustReload, mustStore, myTimerService, pk, readTimeout, reentrant, remote, runningtx, shared, todiscard, txUpdates, waiters, writingtx
 
Constructor Summary
JEntitySwitchDB()
          empty constructor.
 
Method Summary
 void endIH()
          Called only for CS policy, after passivateIH
protected  JEntityContext getContext4Tx(javax.transaction.Transaction tx)
           
 JEntityContext getICtx(javax.transaction.Transaction tx, boolean checkr)
          Get a context/instance associated with this transaction Called at each request on the bean (including remove)
 int getState()
           
protected  void initpolicy(JEntityFactory bf)
           
 int passivateIH(boolean store, boolean passivate)
          try to passivate instances
protected  void removeContext4Tx(javax.transaction.Transaction tx)
           
protected  void setContext4Tx(javax.transaction.Transaction tx, JEntityContext ctx)
           
 void waitmyturn(javax.transaction.Transaction tx)
           
 
Methods inherited from class org.objectweb.jonas_ejb.container.JEntitySwitch
bindICtx, detachPk, discardContext, forceDiscardICtx, getBeanFactory, getBlockingTx, getEntityTimerService, getICtx, getLocal, getPolicy, getPrimaryKey, getRemote, init, lazyRegistering, mapICtx, notifyTimeout, notifyWriting, registerCtx, releaseICtx, terminate, tryBindICtx, txCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ihContext

protected JEntityContext ihContext
EntityContext for non-transacted requests


itsContext

protected java.util.HashMap itsContext
Map of EntityContext's for transactions Key is the Transaction.

Constructor Detail

JEntitySwitchDB

public JEntitySwitchDB()
empty constructor. Object is initialized via init() because it is implemented differently according to jorm mappers.

Method Detail

initpolicy

protected void initpolicy(JEntityFactory bf)
Specified by:
initpolicy in class JEntitySwitch

getContext4Tx

protected JEntityContext getContext4Tx(javax.transaction.Transaction tx)
Parameters:
tx - The Transaction
Returns:
the JEntityContext used for this tx

setContext4Tx

protected void setContext4Tx(javax.transaction.Transaction tx,
                             JEntityContext ctx)
Parameters:
tx - The Transaction
the - JEntityContext used for this tx

removeContext4Tx

protected void removeContext4Tx(javax.transaction.Transaction tx)

waitmyturn

public void waitmyturn(javax.transaction.Transaction tx)

passivateIH

public int passivateIH(boolean store,
                       boolean passivate)
try to passivate instances

Specified by:
passivateIH in class JEntitySwitch
Parameters:
store - not used for this policy
passivate - always true for this policy
Returns:
result of operation: (not really used here) ALL_DONE = instances passivated NOT_DONE = not all passivated

endIH

public void endIH()
Description copied from class: JEntitySwitch
Called only for CS policy, after passivateIH

Specified by:
endIH in class JEntitySwitch

getICtx

public JEntityContext getICtx(javax.transaction.Transaction tx,
                              boolean checkr)
Get a context/instance associated with this transaction Called at each request on the bean (including remove)

Overrides:
getICtx in class JEntitySwitch
Parameters:
tx - - the Transaction object
checkr - - true if we must check non-reentrance.
Returns:
the BeanContext

getState

public int getState()
Specified by:
getState in class JEntitySwitch
Returns:
State of this instance. State values are 0=in-tx, 1=out-tx, 2=idle, 3=passive, 4=removed. we don't synchronize this method to avoid jadmin blocks