org.jboss.ejb
Interface InstanceCache

All Superinterfaces:
AllowedOperationsFlags, ContainerPlugin, org.jboss.system.Service
All Known Subinterfaces:
EntityCache
All Known Implementing Classes:
AbstractInstanceCache, EntityInstanceCache, PerTxEntityInstanceCache

public interface InstanceCache
extends ContainerPlugin

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

Version:
$Revision: 1.12 $
Author:
Rickard ´┐Żberg, Simone Bordet

Field Summary
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
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 get(Object id)
          Gets a bean instance from this cache given the identity.
 long getCacheSize()
          Get the current cache size
 void insert(EnterpriseContext ctx)
          Inserts an active bean instance after creation or activation.
 boolean isActive(Object id)
          Checks whether an instance corresponding to a particular id is active.
 void release(EnterpriseContext ctx)
          Releases the given bean instance from this cache.
 void remove(Object id)
          Removes a bean instance from this cache given the identity.
 
Methods inherited from interface org.jboss.ejb.ContainerPlugin
setContainer
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Method Detail

get

public EnterpriseContext get(Object id)
                      throws RemoteException,
                             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:
RemoteException - In case of illegal calls (concurrent / reentrant)
NoSuchObjectException - if the bean cannot be found.
See Also:
release(org.jboss.ejb.EnterpriseContext)

insert

public void insert(EnterpriseContext 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 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(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(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.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.