Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server
Class Worker

java.lang.Object
  extended by java.lang.Thread
      extended by 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


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Worker(WorkerFactory factory, ErraiService svc)
          Initializes the thread with the specified ThreadGroup, factory and service
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 to
svc - - the service the thread is attached to
Method Detail

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()

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.