APIdia Launch Partner
Top Description Constructors Methods
jdk.internal.vm

public abstract Class ThreadContainer

extends StackableScope
Class Inheritance
Known Direct Subclasses
jdk.internal.vm.ThreadContainers.RootContainer, java.util.concurrent.ThreadPerTaskExecutor, jdk.internal.misc.ThreadFlock.ThreadContainerImpl, jdk.internal.vm.SharedThreadContainer
Imports
java.util.Objects, java.util.stream.Stream

A container of threads.

Constructor Summary

AccessConstructor and Description
protected
ThreadContainer(boolean
true for a shared container, false for a container owned by the current thread
shared
)

Creates a ThreadContainer.

Method Summary

Modifier and TypeMethod and Description
public final void
add(Thread thread)

Adds a thread to this container.

public final Stream<ThreadContainer>
children()

Return the stream of children of this container.

public String
name()

Return the name of this container, may be null.

protected void
onExit(Thread thread)

Invoked by remove to remove a thread from this container when it terminates (or failed to start).

protected void
onStart(Thread thread)

Invoked by add to add a thread to this container before it starts.

public ThreadContainer
parent()

Returns the parent of this container or null if this is the root container.

public final void
remove(Thread thread)

Remove a thread from this container.

public ScopedValueContainer.BindingsSnapshot
scopedValueBindings()

The scoped values captured when the thread container was created.

public long
threadCount()

Return a count of the number of threads in this container.

public abstract Stream<Thread>
threads()

Returns a stream of the live threads in this container.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.vm.StackableScope:
enclosingScopeenclosingScopeheadownerpopAllpopForcefullypreviouspushtryClosetryPop

Constructor Detail

ThreadContainerback to summary
protected ThreadContainer(boolean shared)

Creates a ThreadContainer.

Parameters
shared:boolean

true for a shared container, false for a container owned by the current thread

Method Detail

addback to summary
public final void add(Thread thread)

Adds a thread to this container. This method should be invoked before the thread executes.

childrenback to summary
public final Stream<ThreadContainer> children()

Return the stream of children of this container.

nameback to summary
public String name()

Return the name of this container, may be null.

onExitback to summary
protected void onExit(Thread thread)

Invoked by remove to remove a thread from this container when it terminates (or failed to start).

onStartback to summary
protected void onStart(Thread thread)

Invoked by add to add a thread to this container before it starts.

parentback to summary
public ThreadContainer parent()

Returns the parent of this container or null if this is the root container.

removeback to summary
public final void remove(Thread thread)

Remove a thread from this container. This method can be invoked by the thread itself as it terminates, or it can be invoked by another thread after the given thread has terminated (or failed to start).

scopedValueBindingsback to summary
public ScopedValueContainer.BindingsSnapshot scopedValueBindings()

The scoped values captured when the thread container was created.

threadCountback to summary
public long threadCount()

Return a count of the number of threads in this container.

threadsback to summary
public abstract Stream<Thread> threads()

Returns a stream of the live threads in this container.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override