org.jboss.errai.bus.server
Class Worker
java.lang.Object
java.lang.Thread
org.jboss.errai.bus.server.Worker
- All Implemented Interfaces:
- Runnable
public class Worker
- extends Thread
A Worker is a specialized thread made to work with the messages and services of Errai
Method Summary |
static void |
deliverToBus(MessageBus bus,
Message message)
|
boolean |
isStopped()
|
boolean |
isValid()
Returns true if this thread is valid, and hasn't expired |
void |
run()
Runs the thread, setting the expiry time, and sends the messages associated with this thread |
void |
setActive(boolean active)
Sets the Worker to an active or inactive state |
void |
timeoutInterrupt()
Interrupts this worker thread, and expire it due to a timeout. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Worker
public Worker(WorkerFactory factory,
ErraiService svc)
- Initializes the thread with the specified ThreadGroup, factory and service
- Parameters:
factory
- - the factory this worker thread will belong tosvc
- - the service the thread is attached to
setActive
public void setActive(boolean active)
- Sets the Worker to an active or inactive state
- Parameters:
active
- - true if the thread should be active
isValid
public boolean isValid()
- Returns true if this thread is valid, and hasn't expired
- Returns:
- false if this thread is invalid or has expired
timeoutInterrupt
public void timeoutInterrupt()
- Interrupts this worker thread, and expire it due to a timeout.
Creates an error message if they could not be interrupted
run
public void run()
- Runs the thread, setting the expiry time, and sends the messages associated with this thread
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
deliverToBus
public static void deliverToBus(MessageBus bus,
Message message)
isStopped
public boolean isStopped()
Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.