com.sptci.echo2
Class Controller.Worker<S>

java.lang.Object
  extended by java.lang.Thread
      extended by com.sptci.echo2.Controller.Worker<S>
All Implemented Interfaces:
Runnable
Enclosing class:
Controller<V>

protected abstract class Controller.Worker<S>
extends Thread

An abstract worker thread used to execute tasks in the background to avoid locking up the UI.


Nested Class Summary
(package private)  class Controller.Worker.Executor
          The Runnable that is used to execute the task from the Echo2 TaskQueue.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  String message
          The message to display after completing the task.
protected  String method
          The name of the Method that is to be invoked on source.
protected  int pollingInterval
          The polling interval at which client must poll server for results of task execution.
protected  S source
          The source object on which the specified method is to be invoked.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Controller.Worker()
          Default constructor.
protected Controller.Worker(int pollingInterval, S source, String method, String message)
          Create a new instance of the worker with the specified values.
 
Method Summary
(package private)  void displayMessage()
          Display the contents of message in an instance of ErrorPane.
protected abstract  void execute()
          Execute the method on source.
 void run()
          Implementation of the Runnable interface.
protected  void setMessage(String message)
          Set message.
protected  void setMethod(String method)
          Set method.
protected  void setPollingInterval(int pollingInterval)
          Set pollingInterval.
protected  void setSource(S source)
          Set source.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pollingInterval

protected int pollingInterval
The polling interval at which client must poll server for results of task execution.


source

protected S source
The source object on which the specified method is to be invoked.


method

protected String method
The name of the Method that is to be invoked on source.


message

protected String message
The message to display after completing the task.

Constructor Detail

Controller.Worker

protected Controller.Worker()
Default constructor.


Controller.Worker

protected Controller.Worker(int pollingInterval,
                            S source,
                            String method,
                            String message)
Create a new instance of the worker with the specified values.

Parameters:
pollingInterval - The pollingInterval to set.
source - The source to set.
method - The method to set.
message - The message to set.
Method Detail

run

public void run()
Implementation of the Runnable interface. Delegates to execute().

Specified by:
run in interface Runnable
Overrides:
run in class Thread

execute

protected abstract void execute()
Execute the method on source.


displayMessage

void displayMessage()
Display the contents of message in an instance of ErrorPane.


setPollingInterval

protected void setPollingInterval(int pollingInterval)
Set pollingInterval.

Parameters:
pollingInterval - The value to set.

setSource

protected void setSource(S source)
Set source.

Parameters:
source - The value to set.

setMethod

protected void setMethod(String method)
Set method.

Parameters:
method - The value to set.

setMessage

protected void setMessage(String message)
Set message.

Parameters:
message - The value to set.