|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openejb.core.entity.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.
Inner Class Summary | |
class |
EntityInstanceManager.Key
|
class |
EntityInstanceManager.SyncronizationWrapper
|
Field Summary | |
protected EntityContainer |
container
|
protected Stack |
keyPool
|
protected java.util.HashMap |
poolMap
|
protected int |
poolsize
|
protected static java.lang.reflect.Method |
SET_ENTITY_CONTEXT_METHOD
|
protected Stack |
syncronizationWrapperPool
|
protected SafeToolkit |
toolkit
|
protected java.util.Hashtable |
txReadyPool
|
protected static java.lang.reflect.Method |
UNSET_ENTITY_CONTEXT_METHOD
|
Constructor Summary | |
EntityInstanceManager()
CONSTRUCTOR METHODS |
Method Summary | |
(package private) static void |
|
void |
freeInstance(ThreadContext callContext,
javax.ejb.EntityBean bean)
|
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)
|
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. |
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
protected Stack keyPool
protected Stack syncronizationWrapperPool
protected static java.lang.reflect.Method SET_ENTITY_CONTEXT_METHOD
protected static java.lang.reflect.Method UNSET_ENTITY_CONTEXT_METHOD
protected SafeToolkit toolkit
Constructor Detail |
public EntityInstanceManager()
Method Detail |
static void()
public void init(EntityContainer myContainer, java.util.HashMap deployments, java.util.Properties props) throws OpenEJBException
public javax.ejb.EntityBean obtainInstance(ThreadContext callContext) throws OpenEJBException
protected javax.ejb.EntityBean getPooledInstance(ThreadContext callContext) throws OpenEJBException
public void poolInstance(ThreadContext callContext, javax.ejb.EntityBean bean) throws OpenEJBException
public void freeInstance(ThreadContext callContext, javax.ejb.EntityBean bean) throws SystemException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |