org.jboss.ejb
Interface InstanceCache

All Superinterfaces:
AllowedOperationsFlags (src) , ContainerPlugin (src) , Service (src)
All Known Subinterfaces:
EntityCache (src)
All Known Implementing Classes:
AbstractInstanceCache (src) , EntityInstanceCache (src) , PerTxEntityInstanceCache (src)

public interface InstanceCache
extends ContainerPlugin (src)

The plugin that gives a container a cache for bean instances.


Field Summary
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Method Summary
 void flush()
          Flush the cache.
 EnterpriseContext (src) get(java.lang.Object id)
          Gets a bean instance from this cache given the identity.
 long getCacheSize()
          Get the current cache size
 void insert(EnterpriseContext (src)  ctx)
          Inserts an active bean instance after creation or activation.
 boolean isActive(java.lang.Object id)
          Checks whether an instance corresponding to a particular id is active.
 void release(EnterpriseContext (src)  ctx)
          Releases the given bean instance from this cache.
 void remove(java.lang.Object id)
          Removes a bean instance from this cache given the identity.
 
Methods inherited from interface org.jboss.ejb.ContainerPlugin (src)
setContainer
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Method Detail

get

public EnterpriseContext (src)  get(java.lang.Object id)
                      throws java.rmi.RemoteException,
                             java.rmi.NoSuchObjectException
Gets a bean instance from this cache given the identity. This method may involve activation if the instance is not in the cache.

Implementation should have O(1) complexity.

This method is never called for stateless session beans.

Parameters:
id - The primary key of the bean .
Returns:
The EnterpriseContext related to the given id.
Throws:
java.rmi.RemoteException - In case of illegal calls (concurrent / reentrant)
java.rmi.NoSuchObjectException - if the bean cannot be found.
See Also:
release(org.jboss.ejb.EnterpriseContext)

insert

public void insert(EnterpriseContext (src)  ctx)
Inserts an active bean instance after creation or activation.

Implementation should guarantee proper locking and O(1) complexity.

Parameters:
ctx - The EnterpriseContext to insert in the cache
See Also:
remove(java.lang.Object)

release

public void release(EnterpriseContext (src)  ctx)
Releases the given bean instance from this cache. This method may passivate the bean to get it out of the cache. Implementation should return almost immediately leaving the passivation to be executed by another thread.

Parameters:
ctx - The EnterpriseContext to release
See Also:
get(java.lang.Object)

remove

public void remove(java.lang.Object id)
Removes a bean instance from this cache given the identity. Implementation should have O(1) complexity and guarantee proper locking.

Parameters:
id - The pimary key of the bean.
See Also:
insert(org.jboss.ejb.EnterpriseContext)

isActive

public boolean isActive(java.lang.Object id)
Checks whether an instance corresponding to a particular id is active.

Parameters:
id - The pimary key of the bean.
See Also:
insert(org.jboss.ejb.EnterpriseContext)

getCacheSize

public long getCacheSize()
Get the current cache size

Returns:
the size of the cache

flush

public void flush()
Flush the cache.