org.apache.velocity.util
Class SimplePool

java.lang.Object
  |
  +--org.apache.velocity.util.SimplePool

public final class SimplePool
extends java.lang.Object

Simple object pool. Based on ThreadPool and few other classes The pool will ignore overflow and return null if empty.

Version:
$Id: SimplePool.java,v 1.2.14.1 2004/03/03 23:23:07 geirm Exp $
Author:
Gal Shachor, Costin, Geir Magnusson Jr.

Field Summary
private  int current
          index of previous to next free slot
private  int max
          max amount of objects to be managed set via CTOR
private  java.lang.Object[] pool
           
 
Constructor Summary
SimplePool(int max)
           
 
Method Summary
 java.lang.Object get()
          Get an object from the pool, null if the pool is empty.
 int getMax()
          Return the size of the pool
 void put(java.lang.Object o)
          Add the object to the pool, silent nothing if the pool is full
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

pool

private java.lang.Object[] pool

max

private int max
max amount of objects to be managed set via CTOR

current

private int current
index of previous to next free slot
Constructor Detail

SimplePool

public SimplePool(int max)
Method Detail

put

public void put(java.lang.Object o)
Add the object to the pool, silent nothing if the pool is full

get

public java.lang.Object get()
Get an object from the pool, null if the pool is empty.

getMax

public int getMax()
Return the size of the pool


Copyright © 2002 Apache Software Foundation. All Rights Reserved.