< prev index next >

src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java

Print this page

 925      *
 926      * <p> Construction captures the current thread's {@linkplain ScopedValue scoped
 927      * value} bindings for inheritance by threads started in the scope.
 928      *
 929      * @param joiner the joiner
 930      * @param configOperator the operator to produce the configuration
 931      * @return a new scope
 932      * @param <T> the result type of subtasks executed in the scope
 933      * @param <R> the result type of the scope
 934      * @since 26
 935      */
 936     static <T, R> StructuredTaskScope<T, R> open(Joiner<? super T, ? extends R> joiner,
 937                                                  UnaryOperator<Configuration> configOperator) {
 938         return StructuredTaskScopeImpl.open(joiner, configOperator);
 939     }
 940 
 941     /**
 942      * Opens a new {@code StructuredTaskScope}to use the given {@code Joiner} object. The
 943      * scope is created with the {@linkplain ##DefaultConfiguration default configuration}.
 944      * The default configuration has a {@code ThreadFactory} that creates unnamed
 945      * {@linkplain Thread##irtual-threads virtual threads}, does not name the scope, and
 946      * has no timeout.
 947      *
 948      * @implSpec
 949      * This factory method is equivalent to invoking the 2-arg open method with the given
 950      * joiner and the {@linkplain UnaryOperator#identity() identity operator}.
 951      *
 952      * @param joiner the joiner
 953      * @return a new scope
 954      * @param <T> the result type of subtasks executed in the scope
 955      * @param <R> the result type of the scope
 956      * @since 25
 957      */
 958     static <T, R> StructuredTaskScope<T, R> open(Joiner<? super T, ? extends R> joiner) {
 959         return open(joiner, UnaryOperator.identity());
 960     }
 961 
 962     /**
 963      * Opens a new {@code StructuredTaskScope} that can be used to fork subtasks that return
 964      * results of any type. The scope's {@link #join()} method waits for all subtasks to
 965      * succeed or any subtask to fail.

 925      *
 926      * <p> Construction captures the current thread's {@linkplain ScopedValue scoped
 927      * value} bindings for inheritance by threads started in the scope.
 928      *
 929      * @param joiner the joiner
 930      * @param configOperator the operator to produce the configuration
 931      * @return a new scope
 932      * @param <T> the result type of subtasks executed in the scope
 933      * @param <R> the result type of the scope
 934      * @since 26
 935      */
 936     static <T, R> StructuredTaskScope<T, R> open(Joiner<? super T, ? extends R> joiner,
 937                                                  UnaryOperator<Configuration> configOperator) {
 938         return StructuredTaskScopeImpl.open(joiner, configOperator);
 939     }
 940 
 941     /**
 942      * Opens a new {@code StructuredTaskScope}to use the given {@code Joiner} object. The
 943      * scope is created with the {@linkplain ##DefaultConfiguration default configuration}.
 944      * The default configuration has a {@code ThreadFactory} that creates unnamed
 945      * {@linkplain Thread##virtual-threads virtual threads}, does not name the scope, and
 946      * has no timeout.
 947      *
 948      * @implSpec
 949      * This factory method is equivalent to invoking the 2-arg open method with the given
 950      * joiner and the {@linkplain UnaryOperator#identity() identity operator}.
 951      *
 952      * @param joiner the joiner
 953      * @return a new scope
 954      * @param <T> the result type of subtasks executed in the scope
 955      * @param <R> the result type of the scope
 956      * @since 25
 957      */
 958     static <T, R> StructuredTaskScope<T, R> open(Joiner<? super T, ? extends R> joiner) {
 959         return open(joiner, UnaryOperator.identity());
 960     }
 961 
 962     /**
 963      * Opens a new {@code StructuredTaskScope} that can be used to fork subtasks that return
 964      * results of any type. The scope's {@link #join()} method waits for all subtasks to
 965      * succeed or any subtask to fail.
< prev index next >