Package org.apache.sis.internal.system
Class Threads
java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.system.Threads
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 onReferenceQueueConsumer
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
FieldsModifier and TypeFieldDescription(package private) static final ThreadGroup
The sub-group for daemon threads, usually for resources disposal.(package private) static DaemonThread
The tail of a chain ofDaemonThread
s created by thesis-utility
module.static final ThreadGroup
The parent of every threads declared in this class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
shutdown
(long stopWaitingAt) Sends a kill signal to all daemon threads created by thesis-utility
module, and waits for the threads to die before to return.
-
Field Details
-
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
The sub-group for daemon threads, usually for resources disposal. -
lastCreatedDaemon
The tail of a chain ofDaemonThread
s created by thesis-utility
module. Other modules need to maintain their own chain, if any. See theDaemonThread
javadoc for more information.
-
-
Constructor Details
-
Threads
private Threads()Do not allows instantiation of this class.
-
-
Method Details
-
shutdown
Sends a kill signal to all daemon threads created by thesis-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
- aSystem.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 invokedThread.interrupt()
while we were waiting for the daemon threads to die.
-