groovyx.gpars
Class ThreadLocalPools

java.lang.Object
  extended by java.lang.ThreadLocal<java.util.LinkedList<java.lang.Object>>
      extended by groovyx.gpars.ThreadLocalPools

final class ThreadLocalPools
extends java.lang.ThreadLocal<java.util.LinkedList<java.lang.Object>>

Holds a thread-local stack of pools to allow for nested calls to ForkJoinPool.withPool() or GParsExecutorsPool.withPool()

Author:
Vaclav Pech Date: Dec 15, 2009

Constructor Summary
ThreadLocalPools()
           
 
Method Summary
(package private)  java.lang.Object getCurrent()
          Gives the current element
protected  java.util.LinkedList<java.lang.Object> initialValue()
           
(package private)  void leftShift(java.lang.Object pool)
          Adds a new element
(package private)  void pop()
          Removes the top (last) element
 
Methods inherited from class java.lang.ThreadLocal
get, remove, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalPools

ThreadLocalPools()
Method Detail

initialValue

protected java.util.LinkedList<java.lang.Object> initialValue()
Overrides:
initialValue in class java.lang.ThreadLocal<java.util.LinkedList<java.lang.Object>>

leftShift

void leftShift(java.lang.Object pool)
Adds a new element

Parameters:
pool - The pool to store

pop

void pop()
Removes the top (last) element


getCurrent

java.lang.Object getCurrent()
Gives the current element

Returns:
The retrieved pool

Copyright © 2008–2010 Václav Pech. All Rights Reserved.