## org.jboss.ejb
Interface InstanceCache

All Superinterfaces:
  ContainerPlugin, Service

All Known Subinterfaces:
  EntityCache

All Known Implementing Classes:
  AbstractInstanceCache

public interface InstanceCache
extends ContainerPlugin

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

Version:
  $Revision: 1.6 $
Author:
  Rickard Öberg (rickard.oberg@telkel.com), Simone Bordet (simone.bordet@compaq.com)

Method Summary
`EnterpriseContext` `get(java.lang.Object id)` Gets a bean instance from this cache given the identity.
`void` `insert(EnterpriseContext 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 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
`setContainer`

Methods inherited from interface org.jboss.util.Service
`destroy, init, start, stop`

Method Detail

### get

    public EnterpriseContext 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), 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(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)`

Copyright © 2000 The JBoss Organization. All Rights Reserved.