|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.jonas_ejb.container.JFactory org.objectweb.jonas_ejb.container.JEntityFactory
public class JEntityFactory
This class is a factory for an Entity Bean. It is responsible for - managing Home and LocalHome. - managing a pool of instances/contexts - keeping the list of PKs and the associated JEntitySwitch's - keeping the JNDI context for this component (java:comp/env)
Field Summary | |
---|---|
protected java.util.List |
bctxlist
freelist of JEntityContext's |
protected boolean |
cmp2
True if CMP2 container |
protected java.lang.Object |
datasource
Datasource in case of CMP |
protected boolean |
hardLimit
True if cannot overtake max-cache-size |
protected JEntityHome |
home
optional home |
protected int |
instanceCount
Current number of instances in memory |
protected JEntityLocalHome |
localhome
optional local home |
protected int |
lockPolicy
lock policy |
protected boolean |
prefetch
enable the prefetch for CMP2 bean |
protected int |
readTimeout
Number of seconds before reading again instances for read-only. |
protected boolean |
reentrant
reentrant if instance can be used concurrently |
protected boolean |
shared
shared if the EJB container is not the only one to modify the bean state on the database, or if a cluster of container access the bean concurrently. |
protected java.util.HashMap |
txlist
List of Transaction Listeners. |
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory |
---|
beanclass, cont, dd, ejb10Env, ejbname, ejbTimeoutSignature, isClusterReplicated, JNDICtx, maxCacheSize, minPoolSize, myTimerService, naming, passivationDir, stopped, timerTxAttr, tm, txbeanmanaged, wm |
Constructor Summary | |
---|---|
JEntityFactory()
constructor must be without parameters (required by Jorm) |
Method Summary | |
---|---|
void |
bindEJB(java.lang.Object pk,
JEntitySwitch bs)
Bind a PK with a JEntitySwitch |
int |
calculateAutomaticPk()
Calculate a new uid for automatic pk creation Used by JEntityCmpJdbc.vm |
void |
checkTransaction(RequestCtx rctx)
Check Transaction before calling a method on a bean. |
protected JEntityContext |
createNewContext(javax.ejb.EntityBean bean)
|
protected JEntityContext |
createNewInstance(JEntitySwitch es)
Create a new instance of the bean and its EntityContext In case of CMP, the bean class is derived to manage entity persistence. |
javax.ejb.Timer |
createTimer(java.util.Date arg0,
long arg1,
java.io.Serializable arg2)
Illegal operation: timers are associated with a PK |
javax.ejb.Timer |
createTimer(java.util.Date arg0,
java.io.Serializable arg1)
Illegal operation: timers are associated with a PK |
javax.ejb.Timer |
createTimer(long arg0,
long arg1,
java.io.Serializable arg2)
Illegal operation: timers are associated with a PK /* (non-Javadoc) |
javax.ejb.Timer |
createTimer(long arg0,
java.io.Serializable arg1)
Illegal operation: timers are associated with a PK |
java.io.Serializable |
decodePK(java.io.Serializable strpk)
Decode PK. |
boolean |
dirtyInstances()
|
void |
dummyFinderException(boolean dummy)
Dummy method that defines the FinderException in the throws clause to can catch this exception in any case in the JentityHome.vm |
java.io.Serializable |
encodePK(java.io.Serializable pk)
Encode PK. |
JEntitySwitch |
existEJB(java.lang.Object pk,
JEntitySwitch bs)
get EJB by its PK. |
int |
getCacheSize()
|
int |
getCurrentWaiters()
|
java.lang.Object |
getDataSource()
|
int |
getDeadlockTimeout()
|
JEntitySwitch |
getEJB(java.lang.Object pk)
get EJB by its PK Creates if not exist yet. |
EntityCounters |
getEntityCounters()
Take a dump of current entity counters and return them |
JHome |
getHome()
returns the home if exist or null if not |
int |
getInactivityTimeout()
|
JEntityContext |
getJContext(JEntitySwitch es)
Get a Context from the pool, or create a new one if no more available in the pool. |
JEntitySwitch |
getJEntitySwitch()
This method allocates a new JEntitySwitch. |
JLocalHome |
getLocalHome()
returns the local home if exist or null if not |
int |
getLockPolicy()
|
int |
getMaxWaitTime()
|
int |
getPassivationTimeout()
|
int |
getPoolSize()
Get the size of the instance pool for this bean |
int |
getReadTimeout()
|
boolean |
getSelectForUpdate()
|
java.util.Collection |
getTimers()
Illegal operation: timers are associated with a PK |
javax.ejb.TimerService |
getTimerService()
Obtains the TimerService associated for this Bean |
void |
init(EntityDesc dd,
JContainer cont)
Init this object |
void |
initInstancePool()
Init the pool of instances |
boolean |
isCMP2()
|
boolean |
isDeadLocked(javax.transaction.Transaction suspect)
Search if this transaction is blocked in a deadlock |
boolean |
isHardLimit()
|
boolean |
isPrefetch()
|
boolean |
isReentrant()
|
boolean |
isShared()
|
boolean |
rebindEJB(javax.transaction.Transaction tx,
JEntityContext bctx,
java.lang.Object pk)
rebind a PK with a JEntitySwitch (called by create methods) |
void |
reduceCache()
Reduce number of instances in memory passivate all instances that are not busy and not used very recently |
boolean |
registerContext(javax.transaction.Transaction tx,
JEntityContext ec)
Register a Context/Instance in the transaction. |
void |
registerEJB(JEntitySwitch ejb)
Register an EntitySwitch in the dirty list. |
void |
releaseJContext(JContext ctx)
Release a Context [deprecated] |
void |
releaseJContext(JContext ctx,
int poolaction)
Release a Context |
void |
removeEJB(java.lang.Object pk)
remove an EJB by its PK |
void |
removeTxListener(javax.transaction.Transaction tx)
Remove a Transaction Listener from the list. |
void |
setDeadlockTimeout(int i)
Set the deadlock timeout (jonas admin) Not used today |
void |
setInactivityTimeout(int i)
Set the inactivity timeout (jonas admin) Not used today |
void |
setMaxWaitTime(int sec)
|
void |
setPassivationTimeout(int i)
Set the passivation timeout (jonas admin) Not used today |
void |
stop()
stop this EJB. |
void |
storeInstances(javax.transaction.Transaction tx)
For storing entities modified in tx |
void |
syncDirty(boolean alwaysStore)
Synchronize all dirty instances Does nothing if not CS policy. |
void |
syncForFind(javax.transaction.Transaction tx)
synchronize data modified in this transaction. |
void |
syncForSelect()
synchronize data modified in the current transaction. |
void |
synchronizeEntities()
Ask swapper to synchronize all dirty EntitySwitch Only used for container-serialized policy |
boolean |
tooManyInstances()
|
void |
unregisterContext(javax.transaction.Transaction tx,
JEntityContext ec)
Unregister a Context/Instance in the transaction. |
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory |
---|
checkJonasVersion, checkSecurity, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getInitialContext, getMaxCacheSize, getMinPoolSize, getPassivationDir, getTimerTxAttribute, getTransactionManager, getWorkManager, init, isClassAvailable, isStopped, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, restartTimers, setComponentContext, stopContainer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JEntityHome home
protected JEntityLocalHome localhome
protected int lockPolicy
protected boolean prefetch
protected boolean cmp2
protected boolean shared
protected boolean reentrant
protected int readTimeout
protected java.lang.Object datasource
protected java.util.List bctxlist
protected int instanceCount
protected boolean hardLimit
protected java.util.HashMap txlist
Constructor Detail |
---|
public JEntityFactory()
Method Detail |
---|
public JHome getHome()
BeanFactory
getHome
in interface BeanFactory
public JLocalHome getLocalHome()
BeanFactory
getLocalHome
in interface BeanFactory
public int getLockPolicy()
public boolean isPrefetch()
public boolean isCMP2()
public boolean isShared()
public boolean isReentrant()
public boolean getSelectForUpdate()
public int getReadTimeout()
public int getInactivityTimeout()
public void setInactivityTimeout(int i)
public int getDeadlockTimeout()
public void setDeadlockTimeout(int i)
public int getPassivationTimeout()
public void setPassivationTimeout(int i)
public java.lang.Object getDataSource()
public void dummyFinderException(boolean dummy) throws javax.ejb.FinderException
dummy
- if true do nothing, else throw the FinderException
javax.ejb.FinderException
- if dummy is falsepublic void init(EntityDesc dd, JContainer cont)
dd
- the deployment descriptorcont
- the Containerpublic void stop()
stop
in interface BeanFactory
public int getPoolSize()
BeanFactory
getPoolSize
in interface BeanFactory
getPoolSize
in class JFactory
public int getCacheSize()
getCacheSize
in class JFactory
public boolean tooManyInstances()
public boolean isHardLimit()
public int getCurrentWaiters()
public int getMaxWaitTime()
public void setMaxWaitTime(int sec)
sec
- max time to wait for a connection, in secondspublic void initInstancePool()
initInstancePool
in interface BeanFactory
initInstancePool
in class JFactory
public JEntityContext getJContext(JEntitySwitch es)
public void releaseJContext(JContext ctx, int poolaction)
ctx
- - The JContext to release.poolaction
- 0=never pool, 1=pool if < MinPoolSize, 2=pool if < MaxCacheSizepublic void releaseJContext(JContext ctx)
ctx
- - The JContext to release.protected JEntityContext createNewContext(javax.ejb.EntityBean bean)
protected JEntityContext createNewInstance(JEntitySwitch es) throws java.lang.Exception
java.lang.Exception
- cannot instantiate beanpublic void syncDirty(boolean alwaysStore)
syncDirty
in interface BeanFactory
alwaysStore
- True if we want to store modify instances
even if passivation timeout is not reached.public void reduceCache()
reduceCache
in interface BeanFactory
public boolean dirtyInstances()
public int calculateAutomaticPk()
public java.io.Serializable encodePK(java.io.Serializable pk)
public java.io.Serializable decodePK(java.io.Serializable strpk)
public JEntitySwitch getEJB(java.lang.Object pk)
pk
- The Primary Key Object
public JEntitySwitch existEJB(java.lang.Object pk, JEntitySwitch bs)
pk
- The Primary Key Objectbs
- the Entityswitch
public boolean rebindEJB(javax.transaction.Transaction tx, JEntityContext bctx, java.lang.Object pk)
tx
- current Transactionbctx
- The EntityContextpk
- The Primary Key Object
public void bindEJB(java.lang.Object pk, JEntitySwitch bs)
pk
- The Primary Key Objectbs
- The JEntitySwitchpublic JEntitySwitch getJEntitySwitch()
public void removeEJB(java.lang.Object pk)
pk
- The Primary Key Objectpublic void registerEJB(JEntitySwitch ejb)
ejb
- The Entity Switch to be registeredpublic void synchronizeEntities()
public boolean isDeadLocked(javax.transaction.Transaction suspect)
suspect
- Transaction suspected to block everybody
public EntityCounters getEntityCounters()
public void syncForFind(javax.transaction.Transaction tx)
tx
- the Transactionpublic void syncForSelect()
public void storeInstances(javax.transaction.Transaction tx)
storeInstances
in interface BeanFactory
tx
- current transactionBeanFactory.storeInstances(javax.transaction.Transaction)
public void removeTxListener(javax.transaction.Transaction tx)
tx
- the Transaction to removepublic void unregisterContext(javax.transaction.Transaction tx, JEntityContext ec) throws java.lang.IllegalStateException
tx
- current Transactionctx
- JEntityContext to be registered
java.lang.IllegalStateException
public boolean registerContext(javax.transaction.Transaction tx, JEntityContext ec) throws java.lang.IllegalStateException
tx
- current Transactionctx
- JEntityContext to be registered
java.lang.IllegalStateException
public void checkTransaction(RequestCtx rctx)
rctx
- The Request Contextpublic javax.ejb.TimerService getTimerService()
getTimerService
in class JFactory
public javax.ejb.Timer createTimer(long arg0, java.io.Serializable arg1) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
TimerService.createTimer(long, java.io.Serializable)
public javax.ejb.Timer createTimer(long arg0, long arg1, java.io.Serializable arg2) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
TimerService.createTimer(long, long, java.io.Serializable)
public javax.ejb.Timer createTimer(java.util.Date arg0, java.io.Serializable arg1) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
TimerService.createTimer(java.util.Date, java.io.Serializable)
public javax.ejb.Timer createTimer(java.util.Date arg0, long arg1, java.io.Serializable arg2) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
java.lang.IllegalArgumentException
java.lang.IllegalStateException
javax.ejb.EJBException
TimerService.createTimer(java.util.Date, long, java.io.Serializable)
public java.util.Collection getTimers() throws java.lang.IllegalStateException, javax.ejb.EJBException
getTimers
in interface javax.ejb.TimerService
java.lang.IllegalStateException
javax.ejb.EJBException
TimerService.getTimers()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |