jist.runtime
Class Pool.ContinuationPool

java.lang.Object
  extended by jist.runtime.Pool
      extended by jist.runtime.Pool.ContinuationPool
Enclosing class:
Pool

public static class Pool.ContinuationPool
extends Pool

Implements an object pool for the massively used Continuation objects. Note that, for performance reasons, this class is intentionally NOT thread-safe.

Since:
JIST1.0
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class jist.runtime.Pool
Pool.ArrayPool, Pool.ContinuationPool, Pool.EventPool
 
Field Summary
private  int count
          Index into object pool.
private  Event.Continuation[] pool
          Private object pool.
 
Constructor Summary
Pool.ContinuationPool(int size)
          Create new object pool of fixed given size.
 
Method Summary
 Event.Continuation get()
          Return a Continuation from pool, or create new one if pool empty.
 void put(Event.Continuation cont)
          Place a free (otherwise unused) Continuation object back in the pool, if there is space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pool

private final Event.Continuation[] pool
Private object pool.


count

private int count
Index into object pool.

Constructor Detail

Pool.ContinuationPool

public Pool.ContinuationPool(int size)
Create new object pool of fixed given size.

Parameters:
size - object pool size
Method Detail

get

public Event.Continuation get()
Return a Continuation from pool, or create new one if pool empty.

Returns:
uninitialized Continuation object

put

public void put(Event.Continuation cont)
Place a free (otherwise unused) Continuation object back in the pool, if there is space.

Parameters:
cont - reference to a free Continuation object