|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openejb.core.entity.EntityInstanceManager
public class EntityInstanceManager
One instance of this class is used with each EntityContainer. It is responsible for managing the Method Ready and Transaction Ready pools where bean instances are stored between client calls.
To obtain an instance the obtainInstance( ) method must be called with the primary key and bean type to obtained. The bean instance will be returned form the method ready pool if its not already enrolled in the current transaction, or from the transaction ready pool if it is.
If the bean identity requested is registered with a different tx, a different bean instance is returned which results in both transaction accessing the same bean identity, but using different bean instances.
The poolInstance( ) method is invoked when the client call is finished using the bean instance. the instance will be returned to the transaction ready pool if its registered with a transaction or it will be placed in the method ready pool if its not.
The freeInstance( ) method is invoked in an EJBException or some other RuntimeException occurs. In these situations, the bean instance must be de-registered from the transaction and de-referenced for garbage collection. the freeInstance( ) handles these operations.
This class automatically handles transferring bean instances to the Transaction Ready Pool and transferring them back to the Method Ready pool as necessary.
This class also handles the ejbStore operations by registering the instance with the transaction. The ejbStore Operation doesn't not need to be executed by the container. The container is, however, responsible for the ejbLoad method.
Nested Class Summary | |
---|---|
static class |
EntityInstanceManager.Key
|
protected class |
EntityInstanceManager.SyncronizationWrapper
|
Field Summary | |
---|---|
protected EntityContainer |
container
|
Logger |
logger
|
protected java.util.HashMap |
poolMap
|
protected int |
poolsize
|
protected SafeToolkit |
toolkit
|
protected java.util.Hashtable |
txReadyPool
|
Constructor Summary | |
---|---|
EntityInstanceManager()
CONSTRUCTOR METHODS |
Method Summary | |
---|---|
void |
discardInstance(ThreadContext callContext,
javax.ejb.EntityBean bean)
An instance is freed if a EJBException or some other runtime exception occurs. |
void |
freeInstance(ThreadContext callContext,
javax.ejb.EntityBean bean)
Should be called when an instance is simply removed from the pool Calls unsetEntityContext in the instance. |
protected javax.ejb.EntityBean |
getPooledInstance(ThreadContext callContext)
Obtains a bean instance from the proper bean pool. |
void |
init(EntityContainer myContainer,
java.util.HashMap deployments,
java.util.Properties props)
|
protected void |
loadingBean(javax.ejb.EntityBean bean,
ThreadContext callContext)
called prior to invoking ejbLoad on the bean. |
javax.ejb.EntityBean |
obtainInstance(ThreadContext callContext)
Obtains a bean instance from the either the method ready pool or the Tx method ready pool. |
void |
poolInstance(ThreadContext callContext,
javax.ejb.EntityBean bean)
Returns a bean instance to the method ready or tx method ready pool. |
protected void |
reusingBean(javax.ejb.EntityBean bean,
ThreadContext callContext)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int poolsize
protected EntityContainer container
protected java.util.Hashtable txReadyPool
protected java.util.HashMap poolMap
public Logger logger
protected SafeToolkit toolkit
Constructor Detail |
---|
public EntityInstanceManager()
Method Detail |
---|
public void init(EntityContainer myContainer, java.util.HashMap deployments, java.util.Properties props) throws OpenEJBException
OpenEJBException
public javax.ejb.EntityBean obtainInstance(ThreadContext callContext) throws OpenEJBException
OpenEJBException
protected void loadingBean(javax.ejb.EntityBean bean, ThreadContext callContext) throws OpenEJBException
OpenEJBException
protected void reusingBean(javax.ejb.EntityBean bean, ThreadContext callContext) throws OpenEJBException
OpenEJBException
protected javax.ejb.EntityBean getPooledInstance(ThreadContext callContext) throws OpenEJBException
OpenEJBException
public void poolInstance(ThreadContext callContext, javax.ejb.EntityBean bean) throws OpenEJBException
OpenEJBException
public void freeInstance(ThreadContext callContext, javax.ejb.EntityBean bean) throws SystemException
callContext
- bean
-
SystemException
public void discardInstance(ThreadContext callContext, javax.ejb.EntityBean bean) throws SystemException
callContext
- bean
-
SystemException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |