org.lsst.ccs.utilities.dispatch
Class ParallelObservable<P>

java.lang.Object
  extended by org.lsst.ccs.utilities.dispatch.ParallelObservable<P>

public class ParallelObservable<P>
extends Object

An Observable that notifies Observers through an ExecutorService (that is through different threads).

Author:
bernard AMADE

Field Summary
protected  CopyOnWriteArrayList<ASyncObserver<P>> list
           
protected  ExecutorService loop
          ExecutorService that deals with the Threads handling the commands.
 
Constructor Summary
ParallelObservable()
          Here the threads handling the updates are daemons.
ParallelObservable(ExecutorService execService)
           
 
Method Summary
 void addObserver(ASyncObserver<P> observer)
           
 void notifyObservers(P data)
          do not need a call to setChanged: observers are immediately notified through different threads
 void removeObserver(ASyncObserver<P> observer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected CopyOnWriteArrayList<ASyncObserver<P>> list

loop

protected ExecutorService loop
ExecutorService that deals with the Threads handling the commands.

Constructor Detail

ParallelObservable

public ParallelObservable()
Here the threads handling the updates are daemons. You may change that by using a different constructor with another ExecutorService


ParallelObservable

public ParallelObservable(ExecutorService execService)
Method Detail

addObserver

public void addObserver(ASyncObserver<P> observer)

removeObserver

public void removeObserver(ASyncObserver<P> observer)

notifyObservers

public void notifyObservers(P data)
do not need a call to setChanged: observers are immediately notified through different threads

Parameters:
data -


Copyright © 2012 LSST. All Rights Reserved.