org.opends.server.api
Class DirectoryThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.opends.server.api.DirectoryThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ConnectionHandler, DirectoryServerShutdownHook, DynamicGroupSearchThread, HeartbeatMonitor, HeartbeatThread, IdleTimeLimitThread, IndexRebuildThread, LDAPRequestHandler, ListenerThread, MonitorProvider, PasswordReader, ProfilerThread, ReplayThread, ReplicationDomain, ReplicationServerConnectThread, ReplicationServerListenThread, RotationActionThread, ServerReader, ServerWriter, ShutdownTaskThread, TaskScheduler, TaskThread, TimeThread, TraditionalWorkerThread, WorkThread

@PublicAPI(stability=VOLATILE,
           mayInstantiate=true,
           mayExtend=true,
           mayInvoke=true)
public class DirectoryThread
extends java.lang.Thread

This class defines a generic thread that should be the superclass for all threads created by the Directory Server. That is, instead of having a class that "extends Thread", you should make it "extends DirectoryThread". This provides various value-added capabilities, including:


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
  DirectoryThread(java.lang.Runnable target, java.lang.String threadName)
          Creates a new instance of this directory thread with the specified name and with the specified target as its run object.
protected DirectoryThread(java.lang.String threadName)
          Creates a new instance of this directory thread with the specified name.
protected DirectoryThread(java.lang.ThreadGroup threadGroup, java.lang.String threadName)
          Creates a new instance of this directory thread with the specified name as a part of the given thread group.
 
Method Summary
 Task getAssociatedTask()
          Retrieves the task with which this thread is associated.
 java.lang.StackTraceElement[] getCreationStackTrace()
          Retrieves the stack trace that was captured at the time that this thread was created.
 java.util.Map<java.lang.String,java.lang.String> getDebugProperties()
          Retrieves any relevent debug information with which this tread is associated so they can be included in debug messages.
 java.lang.Thread getParentThread()
          Retrieves a reference to the parent thread that created this directory thread.
 void setAssociatedTask(Task task)
          Sets the task with which this thread is associated.
 
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, run, 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

DirectoryThread

public DirectoryThread(java.lang.Runnable target,
                       java.lang.String threadName)
Creates a new instance of this directory thread with the specified name and with the specified target as its run object.

Parameters:
target - The target runnable object.
threadName - The human-readable name to use for this thread for debugging purposes.

DirectoryThread

protected DirectoryThread(java.lang.String threadName)
Creates a new instance of this directory thread with the specified name.

Parameters:
threadName - The human-readable name to use for this thread for debugging purposes.

DirectoryThread

protected DirectoryThread(java.lang.ThreadGroup threadGroup,
                          java.lang.String threadName)
Creates a new instance of this directory thread with the specified name as a part of the given thread group.

Parameters:
threadGroup - The thread group in which this thread is to be placed.
threadName - The human-readable name to use for this thread for debugging purposes.
Method Detail

getCreationStackTrace

public java.lang.StackTraceElement[] getCreationStackTrace()
Retrieves the stack trace that was captured at the time that this thread was created.

Returns:
The stack trace that was captured at the time that this thread was created.

getParentThread

public java.lang.Thread getParentThread()
Retrieves a reference to the parent thread that created this directory thread. That parent thread may or may not be a directory thread.

Returns:
A reference to the parent thread that created this directory thread.

getAssociatedTask

public Task getAssociatedTask()
Retrieves the task with which this thread is associated. This will only be available for threads that are used in the process of running a task.

Returns:
The task with which this thread is associated, or null if there is none.

setAssociatedTask

public void setAssociatedTask(Task task)
Sets the task with which this thread is associated. It may be null to indicate that it is not associated with any task.

Parameters:
task - The task with which this thread is associated.

getDebugProperties

public java.util.Map<java.lang.String,java.lang.String> getDebugProperties()
Retrieves any relevent debug information with which this tread is associated so they can be included in debug messages.

Returns:
debug information about this thread as a string.