Class Threads

java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.system.Threads

public final class Threads extends Static
Utilities methods for threads. This class declares in a single place every ThreadGroup used in SIS. Their intent is to bring some order in debugger information, by grouping the threads created by SIS together under the same parent tree node.

Note on dependencies

This class shall not depend on ReferenceQueueConsumer or DelayedExecutor, because initialization of those classes create new threads. However, it is okay to have dependencies the other way around.
Since:
0.3
Version:
1.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final ThreadGroup
    The sub-group for daemon threads, usually for resources disposal.
    (package private) static DaemonThread
    The tail of a chain of DaemonThreads created by the sis-utility module.
    static final ThreadGroup
    The parent of every threads declared in this class.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Do not allows instantiation of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static void
    shutdown(long stopWaitingAt)
    Sends a kill signal to all daemon threads created by the sis-utility module, and waits for the threads to die before to return.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SIS

      public static final ThreadGroup SIS
      The parent of every threads declared in this class. This parent will be declared as close as possible to the root of all thread groups (i.e. not as an application thread subgroup). The intent is to separate the library thread groups from the user application thread groups.
    • DAEMONS

      static final ThreadGroup DAEMONS
      The sub-group for daemon threads, usually for resources disposal.
    • lastCreatedDaemon

      static DaemonThread lastCreatedDaemon
      The tail of a chain of DaemonThreads created by the sis-utility module. Other modules need to maintain their own chain, if any. See the DaemonThread javadoc for more information.
  • Constructor Details

    • Threads

      private Threads()
      Do not allows instantiation of this class.
  • Method Details

    • shutdown

      static void shutdown(long stopWaitingAt) throws InterruptedException
      Sends a kill signal to all daemon threads created by the sis-utility module, and waits for the threads to die before to return.

      This method is for internal use by Apache SIS shutdown hooks only. Users should never invoke this method explicitly.

      Parameters:
      stopWaitingAt - a System.nanoTime() value telling when to stop waiting. This is used for preventing shutdown process to block an indefinite amount of time.
      Throws:
      InterruptedException - if another thread invoked Thread.interrupt() while we were waiting for the daemon threads to die.