## org.mortbay.util
Class Pool

    java.lang.Object
      |
      +--org.mortbay.util.Pool

All Implemented Interfaces:
  LifeCycle, java.io.Serializable

public class Pool
extends java.lang.Object
implements LifeCycle, java.io.Serializable

A pool of Objects.

Version:
  $Id: Pool.java,v 1.6.2.1 2003/10/31 12:17:12 gregwilkins Exp $
Author:
  Juancarlo A�ez <juancarlo@modelistica.com>, Greg Wilkins <gregw@mortbay.com>
See Also:
  Serialized Form

Nested Class Summary
`static interface` `Pool.PondLife`

Constructor Summary
`Pool()`

Method Summary
`int` `available()`
`void` `dump(java.lang.String msg)`
`Pool.PondLife` `get(int timeoutMs)`
`java.lang.Object` `getAttribute(java.lang.String name)`
`int` `getMaxIdleTimeMs()`
`int` `getMaxSize()`
`int` `getMinSize()`
`static Pool` `getPool(java.lang.String name)`
`java.lang.Class` `getPoolClass()`
`java.lang.String` `getPoolName()`
`boolean` `isStarted()`
`void` `put(Pool.PondLife pl)`
`void` `setAttribute(java.lang.String name, java.lang.Object value)`
`void` `setMaxIdleTimeMs(int maxIdleTimeMs)`
`void` `setMaxSize(int max)`
`void` `setMinSize(int min)`
`void` `setPoolClass(java.lang.Class poolClass)` Set the class.
`void` `setPoolName(java.lang.String name)`
`void` `shrink()`
`int` `size()`
`void` `start()` Start the LifeCycle.
`void` `stop()` Stop the LifeCycle.

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

Constructor Detail

### Pool

    public Pool()

Method Detail

### getPool

    public static Pool getPool(java.lang.String name)

### getPoolName

    public java.lang.String getPoolName()

  Returns:
    The name of the Pool.

### setPoolName

    public void setPoolName(java.lang.String name)
                     throws java.lang.IllegalStateException

  Parameters:
    `name` - The pool name
  Throws:
    `java.lang.IllegalStateException` - If the name is already defined.

### setPoolClass

    public void setPoolClass(java.lang.Class poolClass)
                      throws java.lang.IllegalStateException

  Set the class.

  Parameters:
    `poolClass` - The class
  Throws:
    `java.lang.IllegalStateException` - If the pool has already been started.

### getPoolClass

    public java.lang.Class getPoolClass()

### getMinSize

    public int getMinSize()

### setMinSize

    public void setMinSize(int min)

### getMaxSize

    public int getMaxSize()

### setMaxSize

    public void setMaxSize(int max)

### getMaxIdleTimeMs

    public int getMaxIdleTimeMs()

### setMaxIdleTimeMs

    public void setMaxIdleTimeMs(int maxIdleTimeMs)

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object value)

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)

### isStarted

    public boolean isStarted()

  Specified by:
    `isStarted` in interface `LifeCycle`
  Returns:
    True if the LifeCycle has been started.

### size

    public int size()

### available

    public int available()

### start

    public void start()
               throws java.lang.Exception

  Description copied from interface: `LifeCycle`
  Start the LifeCycle.

  Specified by:
    `start` in interface `LifeCycle`
  Throws:
    `java.lang.Exception` - An arbitrary exception may be thrown.

### stop

    public void stop()
              throws java.lang.InterruptedException

  Description copied from interface: `LifeCycle`
  Stop the LifeCycle. The LifeCycle may wait for current activities to complete normally, but it can be interrupted.

  Specified by:
    `stop` in interface `LifeCycle`
  Throws:
    `java.lang.InterruptedException` - Stopping a lifecycle is rarely atomic and may be interrupted by another thread. If this happens InterruptedException is throw and the component will be in an indeterminant state and should probably be discarded.

### get

    public Pool.PondLife get(int timeoutMs)
                      throws java.lang.Exception

    `java.lang.Exception`

### put

    public void put(Pool.PondLife pl)
             throws java.lang.InterruptedException

    `java.lang.InterruptedException`

### shrink

    public void shrink()
                throws java.lang.InterruptedException

    `java.lang.InterruptedException`

### dump

    public void dump(java.lang.String msg)

Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.