jrun.ejb.cache
Class EntityInstanceCache

jrunx.kernel.ServiceAdapter
  |
  +--jrun.ejb.cache.EntityInstanceCache
All Implemented Interfaces:
InstanceCache, javax.naming.Referenceable, java.io.Serializable, Service, ServiceMBean

public class EntityInstanceCache
extends ServiceAdapter
implements InstanceCache

This is a simple LRU entity bean cache, that has a maximum size. When the maximum size is reached the least recently inserted instance is passivated. TODO(paul): * configurable caching policies (Spec requires LRU) * purge sizes * disable purging of instances involved in a transaction. EJB Spec 2.0, Section 6.6 page 68.

Author:
Paul Reilly
See Also:
Serialized Form

Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
EntityInstanceCache(InstancePool instancePool, EntityPersistenceManager entityPersistenceManager, int maximumSize, java.lang.String containerName)
           
 
Method Summary
 Instance get(java.lang.Object id)
           
 int getMaximumSize()
           
 void insert(java.lang.Object id, Instance instance)
           
 void remove(java.lang.Object id)
           
 void setMaximumSize(int maximumSize)
           
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, destroy, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, init, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, start, stop, toString, unbind, unscheduleRunnable, updateStatus
 

Constructor Detail

EntityInstanceCache

public EntityInstanceCache(InstancePool instancePool,
                           EntityPersistenceManager entityPersistenceManager,
                           int maximumSize,
                           java.lang.String containerName)
Method Detail

getMaximumSize

public int getMaximumSize()

setMaximumSize

public void setMaximumSize(int maximumSize)

get

public Instance get(java.lang.Object id)
Specified by:
get in interface InstanceCache
Parameters:
id - the id for the cached entity bean.

insert

public void insert(java.lang.Object id,
                   Instance instance)
            throws javax.ejb.EJBException,
                   java.rmi.RemoteException
Specified by:
insert in interface InstanceCache
Parameters:
instance - the entity bean object to be cached.

remove

public void remove(java.lang.Object id)
            throws java.util.NoSuchElementException
Specified by:
remove in interface InstanceCache
Parameters:
id - the primary key for the cached entity bean.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.