Class Reactor
java.lang.Object
java.lang.Thread
org.ovirt.vdsm.jsonrpc.client.reactors.Reactor
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
SSLStompReactor,StompReactor
Provides
Reactor abstraction which reacts on
incoming messages and let ReactorClient process
them.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final org.slf4j.Loggerprivate final ReactorSchedulerprivate final AbstractSelectorprivate static final intFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckActions(Set<SelectionKey> keys) voidclose()createClient(String hostname, int port) protected abstract ReactorClientcreateClient(Reactor reactor, Selector selector, String hostname, int port) protected abstract ReactorClientcreateConnectedClient(Reactor reactor, Selector selector, String hostname, int port, SocketChannel channel) createListener(String hostname, int port, ReactorListener.EventListener owner) protected abstract Stringprivate voidhandleException(Throwable t, ReactorClient client, SelectionKey key, String message) private voidProcessing channels.voidqueueFuture(Future<?> f) voidrun()Main loop for message processing.private voidselect()voidwakeup()Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
TIMEOUT
private static final int TIMEOUT- See Also:
-
selector
-
scheduler
-
isRunning
private boolean isRunning
-
-
Constructor Details
-
Reactor
- Throws:
IOException
-
-
Method Details
-
select
private void select() -
run
public void run()Main loop for message processing. -
processChannels
private void processChannels()Processing channels. -
checkActions
-
handleException
-
queueFuture
-
wakeup
public void wakeup() -
createListener
public Future<ReactorListener> createListener(String hostname, int port, ReactorListener.EventListener owner) -
createClient
- Throws:
ClientConnectionException
-
close
public void close() -
createClient
protected abstract ReactorClient createClient(Reactor reactor, Selector selector, String hostname, int port) -
createConnectedClient
protected abstract ReactorClient createConnectedClient(Reactor reactor, Selector selector, String hostname, int port, SocketChannel channel) throws ClientConnectionException - Throws:
ClientConnectionException
-
getReactorName
-