com.cosylab.epics.caj.impl.reactor.lf
Class LeaderFollowersHandler

java.lang.Object
  extended by com.cosylab.epics.caj.impl.reactor.lf.LeaderFollowersHandler
All Implemented Interfaces:
ReactorHandler, Runnable

public class LeaderFollowersHandler
extends Object
implements ReactorHandler, Runnable

Decorator pattern to 'decorate' application-specific event processing handler to work with Leader/Followers deisgn pattern. This decorator promotes a new leader thread and disables/enables the handler.

Version:
$id$
Author:
Matej Sekoranja

Field Summary
protected  ReactorHandler handler
          Application-specific event processing handler.
protected  Reactor reactor
          Reactor to serve.
protected  LeaderFollowersThreadPool threadPool
          Leader-followers thread pool.
 
Constructor Summary
LeaderFollowersHandler(Reactor reactor, ReactorHandler handler, LeaderFollowersThreadPool threadPool)
          Constructor.
 
Method Summary
 void handleEvent(SelectionKey key)
          Process request of given SelectionKey.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reactor

protected Reactor reactor
Reactor to serve.


handler

protected ReactorHandler handler
Application-specific event processing handler.


threadPool

protected LeaderFollowersThreadPool threadPool
Leader-followers thread pool.

Constructor Detail

LeaderFollowersHandler

public LeaderFollowersHandler(Reactor reactor,
                              ReactorHandler handler,
                              LeaderFollowersThreadPool threadPool)
Constructor.

Parameters:
reactor - reactor to handle.
handler - application-specific event processing handler.
threadPool - leader-followers thread pool.
Method Detail

handleEvent

public void handleEvent(SelectionKey key)
Description copied from interface: ReactorHandler
Process request of given SelectionKey.

Specified by:
handleEvent in interface ReactorHandler
Parameters:
key - key to be processed.
See Also:
ReactorHandler.handleEvent(java.nio.channels.SelectionKey)

run

public void run()
Specified by:
run in interface Runnable
See Also:
Runnable.run()


Copyright © 2004-2013 Cosylab. All Rights Reserved.