net.sf.asyncobjects.vats
Class SingleThreadRunner

java.lang.Object
  extended by net.sf.asyncobjects.vats.VatRunner
      extended by net.sf.asyncobjects.vats.VatQueueRunner
          extended by net.sf.asyncobjects.vats.SingleThreadRunner
All Implemented Interfaces:
ThreadBasedRunner, VatFactory

public class SingleThreadRunner
extends VatQueueRunner
implements ThreadBasedRunner

This is a single thread runner. This runner is a good way to start event loop in the thread.

Author:
const

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatQueueRunner
VatQueueRunner.EnqueuedVat
 
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatRunner
VatRunner.VatRunnerState
 
Field Summary
 
Fields inherited from class net.sf.asyncobjects.vats.VatQueueRunner
queue
 
Fields inherited from class net.sf.asyncobjects.vats.VatRunner
state, stateLock
 
Constructor Summary
SingleThreadRunner()
          A constructor
SingleThreadRunner(String threadName, boolean isDaemon)
          A constructor
 
Method Summary
 void resumeInCurrentThread()
          This methods resumes the suspended runner in the current thread.
 void startInCurrentThread()
          Start runner in the current thread.
 void startInNewThread()
          Start runner in new thread
 void stop()
          Stop this runner
 void suspend()
          This method cases the runner to suspend its work.
 
Methods inherited from class net.sf.asyncobjects.vats.VatQueueRunner
hasEvents
 
Methods inherited from class net.sf.asyncobjects.vats.VatRunner
cancelledEqueuedVat, getBachingFactor, getState, newVat, newVat, setBachingFactor, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.asyncobjects.vats.VatFactory
newVat, newVat
 

Constructor Detail

SingleThreadRunner

public SingleThreadRunner(String threadName,
                          boolean isDaemon)
A constructor

Parameters:
threadName - a thread name
isDaemon - if true a thread will be a daemon thread

SingleThreadRunner

public SingleThreadRunner()
A constructor

Method Detail

startInCurrentThread

public void startInCurrentThread()
Start runner in the current thread.

Specified by:
startInCurrentThread in interface ThreadBasedRunner

startInNewThread

public void startInNewThread()
Start runner in new thread

Specified by:
startInNewThread in interface ThreadBasedRunner

stop

public void stop()
Stop this runner

Specified by:
stop in interface ThreadBasedRunner

suspend

public void suspend()
Description copied from interface: ThreadBasedRunner
This method cases the runner to suspend its work.

Specified by:
suspend in interface ThreadBasedRunner
See Also:
ThreadBasedRunner.suspend()

resumeInCurrentThread

public void resumeInCurrentThread()
Description copied from interface: ThreadBasedRunner
This methods resumes the suspended runner in the current thread.

Specified by:
resumeInCurrentThread in interface ThreadBasedRunner
See Also:
ThreadBasedRunner.resumeInCurrentThread()


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.