Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.ejb.plugins
Class AbstractInstancePool

    java.lang.Object
      |
      +--org.jboss.ejb.plugins.AbstractInstancePool

All Implemented Interfaces:
  ContainerPlugin, InstancePool, Service, XmlLoadable

Direct Known Subclasses:
  EntityInstancePool, MessageDrivenInstancePool, StatefulSessionInstancePool, StatelessSessionInstancePool

public abstract class AbstractInstancePool
extends java.lang.Object
implements InstancePool, XmlLoadable

Abstract Instance Pool class containing the basic logic to create an EJB Instance Pool.

Version:
  $Revision: 1.9.6.9 $

  Revisions:

  20010704 marcf:

  - - Pools if used, do not reuse but restock the pile with fresh instances

  20010920 Sacha Labourey:

  - - Pooling made optional and only activated in concrete subclasses for SLSB and MDB

  20011208 Vincent Harcq:

  - - Added InstancePoolFeeder concept for initializing the pool.
Author:
  Rickard Öberg, Marc Fleury, Andreas Schaefer, Sacha Labourey, Scott Stark/a>
See Also:

Field Summary
`protected Container` | `container` The Container the instance pool is associated with
`protected Logger` | `log` The logging interface
`protected int` | `maxSize` The maximum number of instances allowed in the pool
`protected java.util.Stack` | `pool` The instance pool stack
`protected InstancePoolFeeder` | `poolFeeder` The pool seed task set from the feeder-policy config element
`protected boolean` | `reclaim` determine if we reuse EnterpriseContext objects i.e.

Constructor Summary
`AbstractInstancePool()`

Method Summary
`void` | `add()` Add a instance in the pool by invoking create() with a new bean instance.
`protected abstract EnterpriseContext` | `create(java.lang.Object instance)`
`void` | `destroy()`
`void` | `discard(EnterpriseContext ctx)` Discard an anonymous instance after invocation.
`void` | `free(EnterpriseContext ctx)` Return an instance after invocation.
`EnterpriseContext` | `get()` Get an instance without identity.
`Container` | `getContainer()`
`int` | `getCurrentSize()` Return the size of the pool.
`int` | `getMaxSize()` Get the maximum size of the pool.
`boolean` | `getReclaim()` A pool is reclaim if it push back its dirty instances in its stack.
`void` | `importXml(org.w3c.dom.Element element)` XmlLoadable implementation
`void` | `init()`
`void` | `setContainer(Container c)` Set the callback to the container.
`void` | `setReclaim(boolean reclaim)`
`void` | `start()`
`void` | `stop()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected Logger log

  The logging interface

### container

    protected Container container

  The Container the instance pool is associated with

### pool

    protected java.util.Stack pool

  The instance pool stack

### maxSize

    protected int maxSize

  The maximum number of instances allowed in the pool

### reclaim

    protected boolean reclaim

  determine if we reuse EnterpriseContext objects i.e. if we actually do pooling

### poolFeeder

    protected InstancePoolFeeder poolFeeder

  The pool seed task set from the feeder-policy config element

Constructor Detail

### AbstractInstancePool

    public AbstractInstancePool()

Method Detail

### setContainer

    public void setContainer(Container c)

  Set the callback to the container. This is for initialization. The IM may extract the configuration from the container.
  Specified by:
    `setContainer` in interface `ContainerPlugin`
  Parameters:
    `c` -

### getContainer

    public Container getContainer()

  Returns:
    Callback to the container which can be null if not set proviously

### init

    public void init()
              throws java.lang.Exception

  Specified by:
    `init` in interface `Service`

### start

    public void start()
               throws java.lang.Exception

  Specified by:
    `start` in interface `Service`

### stop

    public void stop()

  Specified by:
    `stop` in interface `Service`

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Service`

### getReclaim

    public boolean getReclaim()

  A pool is reclaim if it push back its dirty instances in its stack.

### setReclaim

    public void setReclaim(boolean reclaim)

### add

    public void add()
             throws java.lang.Exception

  Add a instance in the pool by invoking create() with a new bean instance.
  Specified by:
    `add` in interface `InstancePool`
  Throws:
    `Exception,` - thrown on ctx creation failure

### get

    public EnterpriseContext get()
                          throws java.lang.Exception

  Get an instance without identity. Can be used by finders,create-methods, and activation. This method cannot be synchronized since it may block on the strictMaxSize semaphore.
  Specified by:
    `get` in interface `InstancePool`
  Returns:
    Context with instance
  Throws:
    `java.rmi.RemoteException` -

### free

    public void free(EnterpriseContext ctx)

  Return an instance after invocation. Called in 2 cases: a) Done with finder method b) Just removed
  Specified by:
    `free` in interface `InstancePool`
  Parameters:
    `ctx` -

### discard

    public void discard(EnterpriseContext ctx)

  Description copied from interface: `InstancePool`
  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.
  Specified by:
    `discard` in interface `InstancePool`
  Following copied from interface: `org.jboss.ejb.InstancePool`
  Parameters:
    `ctx` -

### getCurrentSize

    public int getCurrentSize()

  Description copied from interface: `InstancePool`
  Return the size of the pool.
  Specified by:
    `getCurrentSize` in interface `InstancePool`
  Following copied from interface: `org.jboss.ejb.InstancePool`
  Returns:
    the size of the pool.

### getMaxSize

    public int getMaxSize()

  Description copied from interface: `InstancePool`
  Get the maximum size of the pool.
  Specified by:
    `getMaxSize` in interface `InstancePool`
  Following copied from interface: `org.jboss.ejb.InstancePool`
  Returns:
    the size of the pool.

### importXml

    public void importXml(org.w3c.dom.Element element)
                   throws DeploymentException

  XmlLoadable implementation
  Specified by:
    `importXml` in interface `XmlLoadable`

### create

    protected abstract EnterpriseContext create(java.lang.Object instance)
                                         throws java.lang.Exception

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 The JBoss Organization. All Rights Reserved.