org.hsqldb.lib
Class HsqlTaskQueue

java.lang.Object
  extended byorg.hsqldb.lib.HsqlTaskQueue

public class HsqlTaskQueue
extends Object

Provides very simple queued execution of Runnable objects in a background thread. The underlying queue is an HsqlDeque instance, an array-based circular queue implementation with automatic capacity expansion.

Since:
1.7.2
Version:
1.7.2
Author:
boucherb@users.sourceforge.net

Nested Class Summary
protected  class HsqlTaskQueue.TaskRunner
           
 
Field Summary
protected  boolean isShutdown
          true if thread should shut down after processing current task.
protected  HsqlDeque queue
           
protected static Runnable SHUTDOWNTASK
          Special queue element to signal termination
protected  HsqlTaskQueue.TaskRunner taskRunner
           
protected  Thread taskRunnerThread
          The thread used to process commands
 
Constructor Summary
HsqlTaskQueue()
           
 
Method Summary
protected  void clearThread()
           
 void execute(Runnable command)
           
 Thread getTaskRunnerThread()
           
 boolean isShutdown()
           
 void restart()
           
 void shutdownAfterCurrent()
           
 void shutdownAfterQueued()
           
 void shutdownImmediately()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskRunnerThread

protected Thread taskRunnerThread
The thread used to process commands


SHUTDOWNTASK

protected static Runnable SHUTDOWNTASK
Special queue element to signal termination


isShutdown

protected volatile boolean isShutdown
true if thread should shut down after processing current task. Once set true, stays true forever


queue

protected final HsqlDeque queue

taskRunner

protected final HsqlTaskQueue.TaskRunner taskRunner
Constructor Detail

HsqlTaskQueue

public HsqlTaskQueue()
Method Detail

getTaskRunnerThread

public Thread getTaskRunnerThread()

clearThread

protected void clearThread()

isShutdown

public boolean isShutdown()

restart

public void restart()

execute

public void execute(Runnable command)
             throws RuntimeException
Throws:
RuntimeException

shutdownAfterQueued

public void shutdownAfterQueued()

shutdownAfterCurrent

public void shutdownAfterCurrent()

shutdownImmediately

public void shutdownImmediately()


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.