org.ow2.jonas.lib.ejb21
Class JEntitySwitchCST

java.lang.Object
  extended by org.ow2.jonas.lib.ejb21.JEntitySwitch
      extended by org.ow2.jonas.lib.ejb21.JEntitySwitchCST
Direct Known Subclasses:
JEntitySwitchCRU, JEntitySwitchCRW, JEntitySwitchCS, JEntitySwitchRO

public class JEntitySwitchCST
extends JEntitySwitch

Container Serialized Transacted (CST) lock-policy. Transaction Isolation managed by the container. All transactions are serialized.

Author:
Philippe Durieux

Field Summary
protected  JEntityContext itContext
          unique EntityContext
 
Fields inherited from class org.ow2.jonas.lib.ejb21.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
JEntitySwitchCST()
          empty constructor.
 
Method Summary
 void endIH()
          Instance is ready to use for new transaction.
protected  JEntityContext getContext4Tx(Transaction tx)
           
 int getState()
           
protected  void initpolicy(JEntityFactory bf)
           
 int passivateIH(boolean store, boolean passivate)
          try to passivate instances
protected  void removeContext4Tx(Transaction tx)
           
protected  void setContext4Tx(Transaction tx, JEntityContext ctx)
           
 boolean tryBindICtx(Transaction tx, JEntityContext bctx, boolean simple)
          Try to bind a JEntityContext if none already bound.
 void waitmyturn(Transaction tx)
          Wait until I'm allowed to work on this instance.
 
Methods inherited from class org.ow2.jonas.lib.ejb21.JEntitySwitch
bindICtx, detachPk, discardContext, forceDiscardICtx, getBeanFactory, getBlockingTx, getEntityTimerService, getICtx, getICtx, getLocal, getPolicy, getPrimaryKey, getRemote, init, lazyRegistering, mapICtx, notifyTimeout, notifyWriting, registerCtx, releaseICtx, terminate, txCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itContext

protected JEntityContext itContext
unique EntityContext

Constructor Detail

JEntitySwitchCST

public JEntitySwitchCST()
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(Transaction tx)

setContext4Tx

protected void setContext4Tx(Transaction tx,
                             JEntityContext ctx)

removeContext4Tx

protected void removeContext4Tx(Transaction tx)

waitmyturn

public void waitmyturn(Transaction tx)
Wait until I'm allowed to work on this instance. Transaction isolation may be done here, depending on lock-policy.

Parameters:
tx - Transaction

tryBindICtx

public boolean tryBindICtx(Transaction tx,
                           JEntityContext bctx,
                           boolean simple)
                    throws ObjectNotFoundException
Try to bind a JEntityContext if none already bound. Called by finder methods. This is actually kind of optimization. Can be bypassed if problems: just return false.

Overrides:
tryBindICtx in class JEntitySwitch
Parameters:
tx - - the Transaction object
bctx - The Entity Context
simple - True if simple finder method
Returns:
true if context has been bound to this EntitySwitch.
Throws:
ObjectNotFoundException

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()
Instance is ready to use for new transaction.

Specified by:
endIH in class JEntitySwitch

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


Copyright © 2010 OW2 Consortium. All Rights Reserved.