jfun.yan.factory
Interface Pool<T>

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

public interface Pool<T>
extends java.io.Serializable

Represents a pooling strategy for certain object instance.

Zephyr Business Solution

Author:
Ben Yu

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

Method Detail

getInstance

T getInstance(Factory<T> 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

T getPooledInstance(T 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

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