Class DirectoryThread

    • Constructor Detail

      • DirectoryThread

        protected DirectoryThread​(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

        public DirectoryThread​(Runnable target,
                               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.
    • Method Detail

      • 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

        protected 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 Map<String,​String> getDebugProperties()
        Retrieves any relevant 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.
      • isStarting

        public boolean isStarting()
        Returns true if this thread is waiting to be started.
        Returns:
        true if this thread is waiting to be started.
      • isStarted

        public boolean isStarted()
        Returns true if this thread has been started.
        Returns:
        true if this thread has been started.
      • isShutdownInitiated

        public boolean isShutdownInitiated()
        Returns whether the shutdown process has been initiated on the current thread. It also returns true when the thread is actually terminated.

        Waiting for the thread to terminate should be done by invoking one of the Thread.join() methods.

        Returns:
        true if the shutdown process has been initiated on the current thread, false otherwise.
      • initiateShutdown

        public void initiateShutdown()
        Instructs the current thread to initiate the shutdown process. The actual shutdown of the thread is a best effort and is dependent on the implementation of the Thread.run() method.