org.jboss.ejb.plugins
Class EntityInstanceCache

java.lang.Object
  |
  +--org.jboss.ejb.plugins.EnterpriseInstanceCache
        |
        +--org.jboss.ejb.plugins.EntityInstanceCache
All Implemented Interfaces:
ContainerPlugin, EntityInstanceCache, InstanceCache, Service, XmlLoadable

public class EntityInstanceCache
extends EnterpriseInstanceCache
implements EntityInstanceCache

Cache subclass for entity beans.

Version:
$Revision: 1.1 $
Author:
Simone Bordet (simone.bordet@compaq.com)

Inner classes inherited from class org.jboss.ejb.plugins.EnterpriseInstanceCache
EnterpriseInstanceCache.PassivationHelper
 
Constructor Summary
EntityInstanceCache()
           
 
Method Summary
protected  EnterpriseContext acquireContext()
          Acquires an EnterpriseContext from the pool
protected  void activate(EnterpriseContext ctx)
          Activates the given EnterpriseContext
protected  boolean canPassivate(EnterpriseContext ctx)
          Returns whether the given context can be passivated or not
 java.lang.Object createCacheKey(java.lang.Object id)
          Returns the key used to cache the context
protected  void freeContext(EnterpriseContext ctx)
          Frees the given EnterpriseContext to the pool
 EnterpriseContext get(java.lang.Object id)
          Gets a bean instance from this cache given the identity.
protected  Container getContainer()
          Returns the container for this cache.
protected  java.lang.Object getKey(EnterpriseContext ctx)
          Returns the key used by the cache to map the given context
 java.lang.Object getLock(java.lang.Object id)
          Creates (if necessary) and returns an object used as mutex to sync passivation activity with other activities.
protected  void passivate(EnterpriseContext ctx)
          Passivates the given EnterpriseContext
 void remove(java.lang.Object id)
          Removes a bean instance from this cache given the identity.
protected  void removeLock(java.lang.Object id)
          Removes the mutex associated with the given id.
 void setContainer(Container c)
          This callback is set by the container so that the plugin may access it
protected  void setKey(java.lang.Object id, EnterpriseContext ctx)
          Sets the given id as key for the given context
 
Methods inherited from class org.jboss.ejb.plugins.EnterpriseInstanceCache
destroy, getCache, getCacheLock, importXml, init, insert, release, schedulePassivation, start, stop, unschedulePassivation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.ejb.InstanceCache
insert, release
 
Methods inherited from interface org.jboss.util.Service
destroy, init, start, stop
 

Constructor Detail

EntityInstanceCache

public EntityInstanceCache()
Method Detail

setContainer

public void setContainer(Container c)
Description copied from interface: ContainerPlugin
This callback is set by the container so that the plugin may access it
Specified by:
setContainer in interface ContainerPlugin
Following copied from interface: org.jboss.ejb.ContainerPlugin
Parameters:
con - the container using this plugin

createCacheKey

public java.lang.Object createCacheKey(java.lang.Object id)
Description copied from interface: EntityInstanceCache
Returns the key used to cache the context
Specified by:
createCacheKey in interface EntityInstanceCache
Following copied from interface: org.jboss.ejb.EntityInstanceCache
Parameters:
id - Object id / primary key
Returns:
Cache key

get

public EnterpriseContext get(java.lang.Object id)
                      throws java.rmi.RemoteException,
                             java.rmi.NoSuchObjectException
Description copied from interface: InstanceCache
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.
Specified by:
get in interface InstanceCache
Overrides:
get in class EnterpriseInstanceCache
Following copied from interface: org.jboss.ejb.InstanceCache
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), NoSuchObjectException if the bean cannot be found.
See Also:
InstanceCache.release(org.jboss.ejb.EnterpriseContext)

remove

public void remove(java.lang.Object id)
Description copied from interface: InstanceCache
Removes a bean instance from this cache given the identity. Implementation should have O(1) complexity and guarantee proper locking.
Specified by:
remove in interface InstanceCache
Overrides:
remove in class EnterpriseInstanceCache
Following copied from interface: org.jboss.ejb.InstanceCache
Parameters:
id - the pimary key of the bean
See Also:
InstanceCache.insert(org.jboss.ejb.EnterpriseContext)

getLock

public java.lang.Object getLock(java.lang.Object id)
Description copied from class: EnterpriseInstanceCache
Creates (if necessary) and returns an object used as mutex to sync passivation activity with other activities.
The mutex is automatically removed when the corrispondent id is removed from the cache.
Overrides:
getLock in class EnterpriseInstanceCache

removeLock

protected void removeLock(java.lang.Object id)
Description copied from class: EnterpriseInstanceCache
Removes the mutex associated with the given id.
Overrides:
removeLock in class EnterpriseInstanceCache

getKey

protected java.lang.Object getKey(EnterpriseContext ctx)
Description copied from class: EnterpriseInstanceCache
Returns the key used by the cache to map the given context
Overrides:
getKey in class EnterpriseInstanceCache

setKey

protected void setKey(java.lang.Object id,
                      EnterpriseContext ctx)
Description copied from class: EnterpriseInstanceCache
Sets the given id as key for the given context
Overrides:
setKey in class EnterpriseInstanceCache

getContainer

protected Container getContainer()
Description copied from class: EnterpriseInstanceCache
Returns the container for this cache.
Overrides:
getContainer in class EnterpriseInstanceCache

passivate

protected void passivate(EnterpriseContext ctx)
                  throws java.rmi.RemoteException
Description copied from class: EnterpriseInstanceCache
Passivates the given EnterpriseContext
Overrides:
passivate in class EnterpriseInstanceCache

activate

protected void activate(EnterpriseContext ctx)
                 throws java.rmi.RemoteException
Description copied from class: EnterpriseInstanceCache
Activates the given EnterpriseContext
Overrides:
activate in class EnterpriseInstanceCache

acquireContext

protected EnterpriseContext acquireContext()
                                    throws java.lang.Exception
Description copied from class: EnterpriseInstanceCache
Acquires an EnterpriseContext from the pool
Overrides:
acquireContext in class EnterpriseInstanceCache

freeContext

protected void freeContext(EnterpriseContext ctx)
Description copied from class: EnterpriseInstanceCache
Frees the given EnterpriseContext to the pool
Overrides:
freeContext in class EnterpriseInstanceCache

canPassivate

protected boolean canPassivate(EnterpriseContext ctx)
Description copied from class: EnterpriseInstanceCache
Returns whether the given context can be passivated or not
Overrides:
canPassivate in class EnterpriseInstanceCache


Copyright © 2000 The jBoss Organization. All Rights Reserved.