org.codehaus.gpars

groovyx.gpars.pa
[Groovy] Class GParsPoolUtilHelper

java.lang.Object
  groovyx.gpars.pa.GParsPoolUtilHelper

class GParsPoolUtilHelper

Off-loads some of the heavy-on-Groovy functionality from GParsPoolUtil

Authors:
Vaclav Pech


Property Summary
static NullValue MEMOIZE_NULL

 
Constructor Summary
GParsPoolUtilHelper()

 
Method Summary
static groovy.lang.Closure async(groovy.lang.Closure cl)

static groovy.lang.Closure asyncFun(groovy.lang.Closure original, boolean blocking, FJPool pool = null)

static groovy.lang.Closure buildMemoizeFunction(java.util.Map cache, groovy.lang.Closure cl)

static groovy.lang.Closure buildSoftReferenceMemoizeFunction(int protectedCacheSize, java.util.Map cache, groovy.lang.Closure cl)

static java.util.concurrent.Future callAsync(groovy.lang.Closure cl, java.lang.Object... args)

static void cleanUpNullReferences(java.util.Map cache, java.lang.ref.ReferenceQueue queue)

static boolean convertToBoolean(java.lang.Object o)

static ParallelArray createPA(java.lang.Object collection, ForkJoinPool pool)

static ParallelArray createPAFromArray(java.lang.Object[] array, ForkJoinPool pool)

static ParallelArray createPAFromCollection(java.util.Collection collection, ForkJoinPool pool)

static ParallelArray createPAFromCollection(java.lang.Object collection, ForkJoinPool pool)

static void eachParallelPA(ParallelArray pa, groovy.lang.Closure cl)

static ParallelArrayWithMapping eachWithIndex(ParallelArray parallelArray, groovy.lang.Closure cl)

static java.util.Collection findAllParallelPA(ParallelArray pa, groovy.lang.Closure cl)

static java.lang.Object findAnyParallelPA(ParallelArray pa, groovy.lang.Closure cl)

static java.lang.Object findParallelPA(ParallelArray pa, groovy.lang.Closure cl)

static java.lang.Object foldParallel(java.util.Collection collection, java.lang.Object seed, groovy.lang.Closure cl)

static java.lang.Object foldParallel(java.lang.Object collection, java.lang.Object seed, groovy.lang.Closure cl)

static java.util.Collection grepParallelPA(ParallelArray pa, java.lang.Object filter)

static java.lang.Object makeConcurrent(java.lang.Object collection)

Overrides the iterative methods like each(), collect() and such, so that they call their parallel variants from the GParsPoolUtil class like eachParallel(), collectParallel() and such.

static java.lang.Object makeSequential(java.lang.Object collection)

Gives the iterative methods like each() or find() the original sequential semantics.

private static FJPool retrieveFJPool()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

MEMOIZE_NULL

static final NullValue MEMOIZE_NULL


 
Constructor Detail

GParsPoolUtilHelper

GParsPoolUtilHelper()


 
Method Detail

async

static groovy.lang.Closure async(groovy.lang.Closure cl)


asyncFun

static groovy.lang.Closure asyncFun(groovy.lang.Closure original, boolean blocking, FJPool pool = null)


buildMemoizeFunction

static groovy.lang.Closure buildMemoizeFunction(java.util.Map cache, groovy.lang.Closure cl)


buildSoftReferenceMemoizeFunction

static groovy.lang.Closure buildSoftReferenceMemoizeFunction(int protectedCacheSize, java.util.Map cache, groovy.lang.Closure cl)


callAsync

static java.util.concurrent.Future callAsync(groovy.lang.Closure cl, java.lang.Object... args)


cleanUpNullReferences

static void cleanUpNullReferences(java.util.Map cache, java.lang.ref.ReferenceQueue queue)


convertToBoolean

static boolean convertToBoolean(java.lang.Object o)


createPA

@SuppressWarnings("GroovyMultipleReturnPointsPerMethod")
static ParallelArray createPA(java.lang.Object collection, ForkJoinPool pool)


createPAFromArray

static ParallelArray createPAFromArray(java.lang.Object[] array, ForkJoinPool pool)


createPAFromCollection

static ParallelArray createPAFromCollection(java.util.Collection collection, ForkJoinPool pool)


createPAFromCollection

static ParallelArray createPAFromCollection(java.lang.Object collection, ForkJoinPool pool)


eachParallelPA

static void eachParallelPA(ParallelArray pa, groovy.lang.Closure cl)


eachWithIndex

static ParallelArrayWithMapping eachWithIndex(ParallelArray parallelArray, groovy.lang.Closure cl)


findAllParallelPA

static java.util.Collection findAllParallelPA(ParallelArray pa, groovy.lang.Closure cl)


findAnyParallelPA

static java.lang.Object findAnyParallelPA(ParallelArray pa, groovy.lang.Closure cl)


findParallelPA

static java.lang.Object findParallelPA(ParallelArray pa, groovy.lang.Closure cl)


foldParallel

@SuppressWarnings("GroovyAssignabilityCheck")
static java.lang.Object foldParallel(java.util.Collection collection, java.lang.Object seed, groovy.lang.Closure cl)


foldParallel

static java.lang.Object foldParallel(java.lang.Object collection, java.lang.Object seed, groovy.lang.Closure cl)


grepParallelPA

static java.util.Collection grepParallelPA(ParallelArray pa, java.lang.Object filter)


makeConcurrent

static java.lang.Object makeConcurrent(java.lang.Object collection)
Overrides the iterative methods like each(), collect() and such, so that they call their parallel variants from the GParsPoolUtil class like eachParallel(), collectParallel() and such. The first time it is invoked on a collection the method creates a TransparentParallel class instance and mixes it in the object it is invoked on. After mixing-in, the isConcurrent() method will return true. Delegates to GParsPoolUtil.makeConcurrent().
Parameters:
collection - The object to make transparent
Returns:
The instance of the TransparentParallel class wrapping the original object and overriding the iterative methods with new parallel behavior


makeSequential

static java.lang.Object makeSequential(java.lang.Object collection)
Gives the iterative methods like each() or find() the original sequential semantics.
Parameters:
collection - The collection to apply the change to
Returns:
The collection itself


retrieveFJPool

private static FJPool retrieveFJPool()


 

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