Class FixedRunnablePool<T extends RunnableObject>

java.lang.Object
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 Details

    • FixedRunnablePool

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

    • 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 -