jfun.yan
Interface Pool

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
CachingPool, SimplePool, ThreadLocalScope

public interface Pool
extends java.io.Serializable

Represents a pooling strategy for certain object instance.

Zephyr Business Solution

Author:
Ben Yu

Method Summary
 java.lang.Object getInstance(Factory factory)
          Apply the pooling strategy and return an instance from either the pool or the factory.
 java.lang.Object getPooledInstance(java.lang.Object def)
          Get the instance that's already pooled.
 boolean isPooled()
          Is this pool currently having something in cache?
 

Method Detail

getInstance

public java.lang.Object getInstance(Factory factory)
Apply the pooling strategy and return an instance from either the pool or the factory.

Parameters:
factory - the factory to create the object instance.
Returns:
the object instance.

getPooledInstance

public java.lang.Object getPooledInstance(java.lang.Object def)
Get the instance that's already pooled.

Parameters:
def - the default value to return if there's no pooled instance.
Returns:
the pooled instance or the default object.

isPooled

public boolean isPooled()
Is this pool currently having something in cache?