站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

PerTxEntityInstanceCache (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.ejb.plugins
Class PerTxEntityInstanceCache

java.lang.Object
  extended byorg.jboss.ejb.plugins.PerTxEntityInstanceCache
All Implemented Interfaces:
AllowedOperationsFlags, ContainerPlugin, EntityCache, InstanceCache, PerTxEntityInstanceCacheMBean, org.jboss.system.Service

public class PerTxEntityInstanceCache
extends Object
implements EntityCache, PerTxEntityInstanceCacheMBean

Per transaction instance cache.

Version:
$Revision: 1.2 $
Author:
Alexey Loubyansky

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
 
Constructor Summary
PerTxEntityInstanceCache()
           
 
Method Summary
protected  boolean canPassivate(EnterpriseContext ctx)
           
 void create()
           
 Object createCacheKey(Object id)
          Returns the key used to cache the context
 void destroy()
           
 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 instance)
          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 instance)
          Releases the given bean instance from this cache.
 void remove(Object id)
          Removes a bean instance from this cache given the identity.
 void setContainer(Container con)
          This callback is set by the container so that the plugin may access it
 void start()
           
 void stop()
           
protected  void tryToPassivate(EnterpriseContext instance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerTxEntityInstanceCache

public PerTxEntityInstanceCache()
Method Detail

createCacheKey

public Object createCacheKey(Object id)
Description copied from interface: EntityCache
Returns the key used to cache the context

Specified by:
createCacheKey in interface EntityCache
Parameters:
id - Object id / primary key
Returns:
Cache key

get

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

insert

public void insert(EnterpriseContext instance)
Description copied from interface: InstanceCache
Inserts an active bean instance after creation or activation.

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

Specified by:
insert in interface InstanceCache
Parameters:
instance - The EnterpriseContext to insert in the cache
See Also:
InstanceCache.remove(java.lang.Object)

release

public void release(EnterpriseContext instance)
Description copied from interface: InstanceCache
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.

Specified by:
release in interface InstanceCache
Parameters:
instance - The EnterpriseContext to release
See Also:
InstanceCache.get(java.lang.Object)

remove

public void remove(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
Parameters:
id - The pimary key of the bean.
See Also:
InstanceCache.insert(org.jboss.ejb.EnterpriseContext)

isActive

public boolean isActive(Object id)
Description copied from interface: InstanceCache
Checks whether an instance corresponding to a particular id is active.

Specified by:
isActive in interface InstanceCache
Parameters:
id - The pimary key of the bean.
See Also:
InstanceCache.insert(org.jboss.ejb.EnterpriseContext)

getCacheSize

public long getCacheSize()
Description copied from interface: InstanceCache
Get the current cache size

Specified by:
getCacheSize in interface InstanceCache
Returns:
the size of the cache

flush

public void flush()
Description copied from interface: InstanceCache
Flush the cache.

Specified by:
flush in interface InstanceCache

setContainer

public void setContainer(Container con)
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
Parameters:
con - The container using this plugin. This may be null if the plugin is being disassociated from a container.

create

public void create()
            throws Exception
Specified by:
create in interface org.jboss.system.Service
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface org.jboss.system.Service
Throws:
Exception

stop

public void stop()
Specified by:
stop in interface org.jboss.system.Service

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service

tryToPassivate

protected void tryToPassivate(EnterpriseContext instance)

canPassivate

protected boolean canPassivate(EnterpriseContext ctx)


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