org.objectweb.jonas_ejb.container
Class JEntitySwitchCRW

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.JEntitySwitch
      extended by org.objectweb.jonas_ejb.container.JEntitySwitchCST
          extended by org.objectweb.jonas_ejb.container.JEntitySwitchCRW

public class JEntitySwitchCRW
extends JEntitySwitchCST

Container Optimistic lock-policy. Only 1 thread can write. All other threads can read, without waiting for a committed state. There is no wait. This policy cannot be used with shared=true. This policy is only possible for CMP2 entitybeans.

Author:
Philippe Durieux

Field Summary
 
Fields inherited from class org.objectweb.jonas_ejb.container.JEntitySwitchCST
itContext
 
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
JEntitySwitchCRW()
          empty constructor.
 
Method Summary
protected  void initpolicy(JEntityFactory bf)
           
 JEntityContext mapICtx(javax.transaction.Transaction tx, JEntityContext bctx, boolean forced, boolean holdit, boolean notused)
          Map a context and its instance.
 void waitmyturn(javax.transaction.Transaction tx)
          Wait until I'm allowed to work on this instance.
 
Methods inherited from class org.objectweb.jonas_ejb.container.JEntitySwitchCST
endIH, getContext4Tx, getState, passivateIH, removeContext4Tx, setContext4Tx, tryBindICtx
 
Methods inherited from class org.objectweb.jonas_ejb.container.JEntitySwitch
bindICtx, detachPk, discardContext, forceDiscardICtx, getBeanFactory, getBlockingTx, getEntityTimerService, getICtx, getICtx, getLocal, getPolicy, getPrimaryKey, getRemote, init, lazyRegistering, notifyTimeout, notifyWriting, registerCtx, releaseICtx, terminate, txCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JEntitySwitchCRW

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

Method Detail

initpolicy

protected void initpolicy(JEntityFactory bf)
Overrides:
initpolicy in class JEntitySwitchCST

waitmyturn

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

Overrides:
waitmyturn in class JEntitySwitchCST
Parameters:
tx - Transaction

mapICtx

public JEntityContext mapICtx(javax.transaction.Transaction tx,
                              JEntityContext bctx,
                              boolean forced,
                              boolean holdit,
                              boolean notused)
Map a context and its instance. Could use the inherited method here. This is just a simplified version for performances.

Overrides:
mapICtx in class JEntitySwitch
Parameters:
tx - - the Transaction object
bctx - - the JEntityContext to bind if not null
forced - - force to take this context. (case of create)
holdit - - increment count to hold it, a release will be called later.
notused - - true if we must check non-reentrance.
Returns:
JEntityContext actually mapped