org.apache.velocity.util

Class 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 2001/03/31 05:25:22 geirm Exp $

Authors:
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 Object[]
pool

Constructor Summary

SimplePool(int max)

Method Summary

Object
get()
Get an object from the pool, null if the pool is empty.
int
getMax()
Return the size of the pool
void
put(Object o)
Add the object to the pool, silent nothing if the pool is full

Field Details

current

private int current
index of previous to next free slot


max

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


pool

private Object[] pool

Constructor Details

SimplePool

public SimplePool(int max)

Method Details

get

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


getMax

public int getMax()
Return the size of the pool


put

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


Copyright © 2003 Apache Software Foundation. All Rights Reserved.