## org.jboss.ejb
Interface InstancePool

All Superinterfaces:
  ContainerPlugin, Service

All Known Implementing Classes:
  AbstractInstancePool, SingletonStatelessSessionInstancePool

public interface InstancePool
extends ContainerPlugin

Interface for bean instance Pools.

Version:
  $Revision: 1.3.6.4 $

  Revisions:

  20011208 Vincent Harcq:

  - Added a Pool Feeder (Thread that pre-create bean instances to avoid setContext overhead.
Author:
  Rickard Öberg (rickard.oberg@telkel.com)
See Also:
  <related>

Method Summary
`void` `add()` Add an instance in the Pool.
`void` `discard(EnterpriseContext ctx)` Discard an anonymous instance after invocation.
`void` `free(EnterpriseContext ctx)` Return an anonymous instance after invocation.
`EnterpriseContext` `get()` Get an instance without identity.
`int` `getCurrentSize()` Return the size of the pool.
`int` `getMaxSize()` Get the maximum size of the pool.

Methods inherited from interface org.jboss.ejb.ContainerPlugin
`setContainer`

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

Method Detail

### add

    public void add()
             throws java.lang.Exception

  Add an instance in the Pool. Is used by the TimedInstancePoolFeeder thread to create instances ready for use by the interceptor.
  Throws:
    `java.lang.Exception` - when an Instance can not be instantiated

### get

    public EnterpriseContext get()
                          throws java.lang.Exception

  Get an instance without identity. Can be used by finders and create-methods, or stateless beans
  Returns:
    Context /w instance
  Throws:
    `RemoteException` -

### free

    public void free(EnterpriseContext ctx)

  Return an anonymous instance after invocation.
  Parameters:
    `ctx` -

### discard

    public void discard(EnterpriseContext ctx)

  Discard an anonymous instance after invocation. This is called if the instance should not be reused, perhaps due to some exception being thrown from it.
  Parameters:
    `ctx` -

### getCurrentSize

    public int getCurrentSize()

  Return the size of the pool.
  Returns:
    the size of the pool.

### getMaxSize

    public int getMaxSize()

  Get the maximum size of the pool.
  Returns:
    the size of the pool.

Copyright © 2000 The JBoss Organization. All Rights Reserved.