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

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

public class SynchronousDispatchProxy<I>
extends Object

Instances of this class creates a dynamic proxy that 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.

Author:
Bernard AMADE

Field Summary
protected  CopyOnWriteArrayList<Object> list
           
protected  I proxy
           
 
Constructor Summary
SynchronousDispatchProxy(Class<I> interfaceType)
          prepares a generator able to deliver a Proxy object able to dispatch method calls to registered agents.
SynchronousDispatchProxy(Class<I> interfaceType, 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 CopyOnWriteArrayList<Object> list

proxy

protected I proxy
Constructor Detail

SynchronousDispatchProxy

public SynchronousDispatchProxy(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 -

SynchronousDispatchProxy

public SynchronousDispatchProxy(Class<I> interfaceType,
                                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 © 2013 LSST. All Rights Reserved.