org.jgroups.blocks.executor
Class Executions

java.lang.Object
  extended by org.jgroups.blocks.executor.Executions

public class Executions
extends java.lang.Object


Nested Class Summary
protected static class Executions.StreamableCallable
           
 
Constructor Summary
Executions()
           
 
Method Summary
static java.util.concurrent.Callable<?> serializableCallable(java.lang.reflect.Constructor<? extends java.util.concurrent.Callable> constructorToUse, java.lang.Object... args)
          This method should be used to convert a callable that would not normally be serializable, externalizable or streamable but has serializable, externalizable or streamable arguments to a constructor to construct it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Executions

public Executions()
Method Detail

serializableCallable

public static java.util.concurrent.Callable<?> serializableCallable(java.lang.reflect.Constructor<? extends java.util.concurrent.Callable> constructorToUse,
                                                                    java.lang.Object... args)
                                                             throws java.lang.IllegalArgumentException
This method should be used to convert a callable that would not normally be serializable, externalizable or streamable but has serializable, externalizable or streamable arguments to a constructor to construct it.

When the call method is called on the callable it will call the provided constructor passing in the given arguments. It will then invoke the call method on resulting callable that was created.

The amount of arguments cannot exceed Byte.MAX_VALUE. Also the constructor cannot exceed Byte.MAX_VALUE position in the constructor array returned from Class.getConstructors()

The amount of arguments must match the amount of arguments required by the constructor. Also the arguments must be compatibile with the types required of the constructor.

Unfortunately it isn't easy to pass a Constructor> so we can't pass back a callable that is properly typed. Also this forces the caller to cast their callable or returned value to the correct type manually.

Parameters:
constructorToUse - The constructor to use when creating the callable
args - The arguments to pass to the constructor
Returns:
The callable that will upon being called will instantiate the given callable using the constructor with the provided arguments and calls the call method
Throws:
java.lang.IllegalArgumentException - This is thrown if the arguments are not serializable, externalizable or streamable. It can be thrown if the constructo is not accessible. It can also be thrown if too many arguments or the constructor is to high up in the constructo array returned by the class.


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.