org.lsst.ccs.utilities.dispatch
Class ParallelDispatchProxy<I>

java.lang.Object
  extended by org.lsst.ccs.utilities.dispatch.ParallelDispatchProxy<I>

public class ParallelDispatchProxy<I>
extends Object

Instances of this class creates a dynamic proxy that parallely dispatches method call to registered agents implementing an interface type.

beware : if the implemented interface is itself a parameterized type no type control is exercised on these type parameters.


Field Summary
protected  CopyOnWriteArrayList<Object> list
           
protected  ExecutorService loop
           
protected  I proxy
           
 
Constructor Summary
ParallelDispatchProxy(Class<I> interfaceType)
          prepares a generator able to deliver a Proxy object able to dispatch method calls to registered agents.
ParallelDispatchProxy(Class<I> interfaceType, boolean singleThread)
          Same as ParallelDispatchProxy but specification of a single Thread dispatch can be added.
ParallelDispatchProxy(Class<I> interfaceType, ClassLoader loader)
          Same as previous but with a specified ClassLoader
ParallelDispatchProxy(Class<I> interfaceType, ClassLoader loader, boolean singleThread)
           
 
Method Summary
<T extends I>
void
addExecutant(T executant)
          Registers a code ready to receive "synchronous" commands
 I getProxy()
          to be called once to get a dynamically generated proxy that will forward calls to registered agents.
<T extends I>
void
removeExecutant(T executant)
          Remove the code from the listeners list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected CopyOnWriteArrayList<Object> list

proxy

protected I proxy

loop

protected ExecutorService loop
Constructor Detail

ParallelDispatchProxy

public ParallelDispatchProxy(Class<I> interfaceType)
prepares a generator able to deliver a Proxy object able to dispatch method calls to registered agents. The methods of the interface will necessarily be of procedural nature (the return values will be dumped)

Parameters:
interfaceType -

ParallelDispatchProxy

public ParallelDispatchProxy(Class<I> interfaceType,
                             boolean singleThread)
Same as ParallelDispatchProxy but specification of a single Thread dispatch can be added.

Parameters:
interfaceType -
singleThread -

ParallelDispatchProxy

public ParallelDispatchProxy(Class<I> interfaceType,
                             ClassLoader loader)
Same as previous but with a specified ClassLoader

Parameters:
interfaceType -
loader -

ParallelDispatchProxy

public ParallelDispatchProxy(Class<I> interfaceType,
                             ClassLoader loader,
                             boolean singleThread)
Method Detail

addExecutant

public <T extends I> void addExecutant(T executant)
Registers a code ready to receive "synchronous" commands

Parameters:
executant - (should implement the interface)

removeExecutant

public <T extends I> void removeExecutant(T executant)
Remove the code from the listeners list

Parameters:
executant -

getProxy

public I getProxy()
to be called once to get a dynamically generated proxy that will forward calls to registered agents.

Returns:


Copyright © 2012 LSST. All Rights Reserved.