com.epam.common.thread.runnable
Class FixedRunnablePool<T extends RunnableObject>

java.lang.Object
  extended by com.epam.common.thread.runnable.FixedRunnablePool<T>
All Implemented Interfaces:
RunnablePool<T>

public class FixedRunnablePool<T extends RunnableObject>
extends Object
implements RunnablePool<T>

Pool have fixed size.

Create new objects if pool is empty.

Skip objects if the pool is full. Object should be collected by GC in this case. User: Mykhailo_Sereda Date: 05.11.12 Time: 15:18


Constructor Summary
FixedRunnablePool(int minSize, int maxSize, RunnableFactory<T> objectFactory)
           
 
Method Summary
protected  T createNew()
           
 T get()
          Get object from pool.
 void release(T ob)
          Try return object to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedRunnablePool

public FixedRunnablePool(int minSize,
                         int maxSize,
                         RunnableFactory<T> objectFactory)
Method Detail

get

public T get()
Get object from pool. Create new object if pool is empty.

Specified by:
get in interface RunnablePool<T extends RunnableObject>
Returns:

createNew

protected T createNew()

release

public void release(T ob)
Try return object to the pool. Skip object if the pool is full.

Specified by:
release in interface RunnablePool<T extends RunnableObject>
Parameters:
ob -


Copyright © 2000-2014 EPAM Systems. All Rights Reserved.