APIdia Launch Partner
Top Description Inners Constructors Methods
java.util.concurrent

pack-priv Class Joiners

extends Object
Class Inheritance
Imports
java.lang.invoke.MethodHandles, .VarHandle, java.util.ArrayList, .Comparator, .List, .NoSuchElementException, .Objects, java.util.concurrent.StructuredTaskScope.Joiner, .StructuredTaskScope.Subtask, .StructuredTaskScope.CancelledByTimeoutException, java.util.function.Function, .Predicate, jdk.internal.invoke.MhUtil

Built-in StructuredTaskScope.Joiner implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Joiners.AllSubtasks<T>

A joiner that returns a list of all subtasks.

pack-priv static class
Joiners.AllSuccessful<T, R_X extends Throwable>

A joiner that returns a list of all results when all subtasks complete successfully.

pack-priv static class
Joiners.AnySuccessful<T, R_X extends Throwable>

A joiner that returns the result of the first subtask to complete successfully.

pack-priv static class
Joiners.AwaitSuccessful<T, R_X extends Throwable>

A joiner that that waits for all successful subtasks.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static StructuredTaskScope.Subtask.State
ensureCompleted(StructuredTaskScope.Subtask<?> subtask)

Throws IllegalArgumentException if the subtask has not completed.

private static void
ensureUnavailable(StructuredTaskScope.Subtask<?> subtask)

Throws IllegalArgumentException if the subtask is not in the UNAVAILABLE state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Joinersback to summary
private Joiners()

Method Detail

ensureCompletedback to summary
private static StructuredTaskScope.Subtask.State ensureCompleted(StructuredTaskScope.Subtask<?> subtask)

Throws IllegalArgumentException if the subtask has not completed.

ensureUnavailableback to summary
private static void ensureUnavailable(StructuredTaskScope.Subtask<?> subtask)

Throws IllegalArgumentException if the subtask is not in the UNAVAILABLE state.

java.util.concurrent back to summary

pack-priv final Class Joiners.AllSubtasks<T>

extends Object
implements StructuredTaskScope.Joiner<T, List<StructuredTaskScope.Subtask<T>>, RuntimeException>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.StructuredTaskScope.Joiner

A joiner that returns a list of all subtasks.

Field Summary

Modifier and TypeField and Description
private final Predicate<? super StructuredTaskScope.Subtask<T>>
private List<StructuredTaskScope.Subtask<T>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception.

public boolean
public List<StructuredTaskScope.Subtask<T>>
result()

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled.

public List<StructuredTaskScope.Subtask<T>>
timeout()

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isDoneback to summary
private final Predicate<? super StructuredTaskScope.Subtask<T>> isDone
subtasksback to summary
private List<StructuredTaskScope.Subtask<T>> subtasks

Constructor Detail

AllSubtasksback to summary
pack-priv AllSubtasks(Predicate<? super StructuredTaskScope.Subtask<T>> isDone)

Method Detail

onCompleteback to summary
public boolean onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception. This method is not invoked by subtasks that complete after the scope is cancelled.

Annotations
@Override
onForkback to summary
public boolean onFork(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onFork.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onFork.

Invoked by fork(Callable) and fork(Runnable) when forking a subtask. The method is invoked before a thread is created to execute the subtask.

Annotations
@Override
resultback to summary
public List<StructuredTaskScope.Subtask<T>> result()

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled. This method is not invoked if the scope was opened with a timeout and the timeout expires before or while waiting.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
timeoutback to summary
public List<StructuredTaskScope.Subtask<T>> timeout()

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

If the outcome is an exception, this method throws the exception with a CancelledByTimeoutException as the cause.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
java.util.concurrent back to summary

pack-priv final Class Joiners.AllSuccessful<T, R_X extends Throwable>

extends Object
implements StructuredTaskScope.Joiner<T, List<T>, R_X extends Throwable>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.StructuredTaskScope.Joiner

A joiner that returns a list of all results when all subtasks complete successfully. Cancels the scope if any subtask fails.

Field Summary

Modifier and TypeField and Description
private final Function<Throwable, R_X>
private static final VarHandle
private volatile Throwable
private List<StructuredTaskScope.Subtask<T>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception.

public boolean
public List<T>
result()

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled.

public List<T>
timeout()

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

esfback to summary
private final Function<Throwable, R_X> esf
FIRST_EXCEPTIONback to summary
private static final VarHandle FIRST_EXCEPTION
firstExceptionback to summary
private volatile Throwable firstException
subtasksback to summary
private List<StructuredTaskScope.Subtask<T>> subtasks

Constructor Detail

AllSuccessfulback to summary
pack-priv AllSuccessful(Function<Throwable, R_X> esf)

Method Detail

onCompleteback to summary
public boolean onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception. This method is not invoked by subtasks that complete after the scope is cancelled.

Annotations
@Override
onForkback to summary
public boolean onFork(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onFork.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onFork.

Invoked by fork(Callable) and fork(Runnable) when forking a subtask. The method is invoked before a thread is created to execute the subtask.

Annotations
@Override
resultback to summary
public List<T> result() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled. This method is not invoked if the scope was opened with a timeout and the timeout expires before or while waiting.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
if the outcome is an exception
timeoutback to summary
public List<T> timeout() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

If the outcome is an exception, this method throws the exception with a CancelledByTimeoutException as the cause.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
with a cause of CancelledByTimeoutException, if the outcome is an exception
java.util.concurrent back to summary

pack-priv final Class Joiners.AnySuccessful<T, R_X extends Throwable>

extends Object
implements StructuredTaskScope.Joiner<T, T, R_X extends Throwable>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.StructuredTaskScope.Joiner

A joiner that returns the result of the first subtask to complete successfully. Cancels the scope if any subtasks succeeds.

Field Summary

Modifier and TypeField and Description
private final Function<Throwable, R_X>
private static final VarHandle
private volatile StructuredTaskScope.Subtask<T>
private static final Comparator<StructuredTaskScope.Subtask.State>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception.

public T
result()

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled.

private static int
stateToInt(StructuredTaskScope.Subtask.State s)

Maps a Subtask.State to an int that can be compared.

public T
timeout()

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

esfback to summary
private final Function<Throwable, R_X> esf
SUBTASKback to summary
private static final VarHandle SUBTASK
subtaskback to summary
private volatile StructuredTaskScope.Subtask<T> subtask
SUBTASK_STATE_COMPARATORback to summary
private static final Comparator<StructuredTaskScope.Subtask.State> SUBTASK_STATE_COMPARATOR

Constructor Detail

AnySuccessfulback to summary
pack-priv AnySuccessful(Function<Throwable, R_X> esf)

Method Detail

onCompleteback to summary
public boolean onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception. This method is not invoked by subtasks that complete after the scope is cancelled.

Annotations
@Override
resultback to summary
public T result() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled. This method is not invoked if the scope was opened with a timeout and the timeout expires before or while waiting.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
if the outcome is an exception
stateToIntback to summary
private static int stateToInt(StructuredTaskScope.Subtask.State s)

Maps a Subtask.State to an int that can be compared.

timeoutback to summary
public T timeout() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

If the outcome is an exception, this method throws the exception with a CancelledByTimeoutException as the cause.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
with a cause of CancelledByTimeoutException, if the outcome is an exception
java.util.concurrent back to summary

pack-priv final Class Joiners.AwaitSuccessful<T, R_X extends Throwable>

extends Object
implements StructuredTaskScope.Joiner<T, Void, R_X extends Throwable>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.StructuredTaskScope.Joiner

A joiner that that waits for all successful subtasks. Cancels the scope if any subtask fails.

Field Summary

Modifier and TypeField and Description
private final Function<Throwable, R_X>
private static final VarHandle
private volatile Throwable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception.

public Void
result()

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled.

public Void
timeout()

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

esfback to summary
private final Function<Throwable, R_X> esf
FIRST_EXCEPTIONback to summary
private static final VarHandle FIRST_EXCEPTION
firstExceptionback to summary
private volatile Throwable firstException

Constructor Detail

AwaitSuccessfulback to summary
pack-priv AwaitSuccessful(Function<Throwable, R_X> esf)

Method Detail

onCompleteback to summary
public boolean onComplete(StructuredTaskScope.Subtask<T> subtask)

Overrides default java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.onComplete.

Invoked by the thread that executed a subtask after the subtask completes successfully or fails with an exception. This method is not invoked by subtasks that complete after the scope is cancelled.

Annotations
@Override
resultback to summary
public Void result() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.result.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.result.

Invoked by the join() method to produce the outcome (result or exception) after waiting for all subtasks to complete or the scope is cancelled. This method is not invoked if the scope was opened with a timeout and the timeout expires before or while waiting.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
if the outcome is an exception
timeoutback to summary
public Void timeout() throws Joiner:R_X

Implements java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Doc from java.util.concurrent.StructuredTaskScope.Joiner.timeout.

Invoked by the join() method to produce the outcome (result or exception) when the scope was opened with a timeout and the timeout expires before or while waiting in the join() method.

If the outcome is an exception, this method throws the exception with a CancelledByTimeoutException as the cause.

This method will be called at most once, by the join() method, to produce the outcome. The behavior of this method when invoked directly is undefined.

Annotations
@Override
Exceptions
Joiner:R_X:
with a cause of CancelledByTimeoutException, if the outcome is an exception