Package org.epics.ca.impl.reactor.lf
Class LeaderFollowersHandler
- java.lang.Object
-
- org.epics.ca.impl.reactor.lf.LeaderFollowersHandler
-
- All Implemented Interfaces:
java.lang.Runnable,ReactorHandler
public class LeaderFollowersHandler extends java.lang.Object implements ReactorHandler, java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected ReactorHandlerhandlerApplication-specific event processing handler.protected ReactorreactorReactor to serve.protected LeaderFollowersThreadPoolthreadPoolLeader-followers thread pool.
-
Constructor Summary
Constructors Constructor Description LeaderFollowersHandler(Reactor reactor, ReactorHandler handler, LeaderFollowersThreadPool threadPool)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandleEvent(java.nio.channels.SelectionKey key)Process request of givenSelectionKey.voidrun()
-
-
-
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(java.nio.channels.SelectionKey key)
Description copied from interface:ReactorHandlerProcess request of givenSelectionKey.- Specified by:
handleEventin interfaceReactorHandler- Parameters:
key- key to be processed.- See Also:
ReactorHandler.handleEvent(java.nio.channels.SelectionKey)
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- See Also:
Runnable.run()
-
-