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 java.lang.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  java.util.concurrent.CopyOnWriteArrayList<java.lang.Object> list
           
protected  java.util.concurrent.ExecutorService loop
           
protected  I proxy
           
 
Constructor Summary
ParallelDispatchProxy(java.lang.Class<I> interfaceType)
          prepares a generator able to deliver a Proxy object able to dispatch method calls to registered agents.
ParallelDispatchProxy(java.lang.Class<I> interfaceType, java.lang.ClassLoader loader)
          Same as previous but with a specified ClassLoader
 
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 java.util.concurrent.CopyOnWriteArrayList<java.lang.Object> list

proxy

protected I proxy

loop

protected java.util.concurrent.ExecutorService loop
Constructor Detail

ParallelDispatchProxy

public ParallelDispatchProxy(java.lang.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(java.lang.Class<I> interfaceType,
                             java.lang.ClassLoader loader)
Same as previous but with a specified ClassLoader

Parameters:
interfaceType -
loader -
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.