|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.hypergraphdb.util.ActionQueueThread
public class ActionQueueThread
This a simple queue that runs as a thread and executes passed
in action object (i.e. Runnable instances) in a
sequence. It can be configured with a maximum size. When this maximum
size is reached and a new element is added to it, it will not return
until some percentage of the accumulated actions has been completed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
DEFAULT_FREE_PERCENT_ON_BLOCK
|
static int |
DEFAULT_NON_BLOCKING_SIZE
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
ActionQueueThread()
Default constructor. |
|
ActionQueueThread(java.lang.String name)
Constructs an ActionQueue with a specific thread
name and a default max size. |
|
ActionQueueThread(java.lang.String name,
int maxSizeBeforeBlock,
int completePercentUponBlocking)
Constructs an ActionQueue with a specific thread
name and max size. |
|
| Method Summary | |
|---|---|
void |
addAction(java.lang.Runnable runnable)
|
void |
completeAll()
Complete all scheduled actions at the time of this call. |
long |
getCompletedCount()
Return the total number of actions executed by this thread, whether or not the actions have terminated with an exception. |
boolean |
isRunning()
|
void |
run()
|
void |
stopRunning()
|
| 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 |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_NON_BLOCKING_SIZE
public static final int DEFAULT_FREE_PERCENT_ON_BLOCK
| Constructor Detail |
|---|
public ActionQueueThread()
Default constructor. Unnamed action queue with a default max size.
public ActionQueueThread(java.lang.String name)
Constructs an ActionQueue with a specific thread
name and a default max size.
name - The name of the action queue thread.
public ActionQueueThread(java.lang.String name,
int maxSizeBeforeBlock,
int completePercentUponBlocking)
Constructs an ActionQueue with a specific thread
name and max size.
name - The name of the action queue thread.maxSizeBeforeBlock - The maximum number of actions waiting in the queue
before this ActionQueue blocks a calling thread.completPercentUponBlocking - The amount, in percent, of action to execute
from a filled up queue before we return to the blocked thread.| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void addAction(java.lang.Runnable runnable)
public void completeAll()
Complete all scheduled actions at the time of this call. Since other threads may keep adding actions, this method makes sure that only the actions in the queue at the time of the call are waited upon.
public long getCompletedCount()
Return the total number of actions executed by this thread, whether or not the actions have terminated with an exception.
public boolean isRunning()
public void stopRunning()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||