Spec-Zone.ru › OpenJDK 27

Interface StructuredTaskScope.Configuration

Enclosing interface:
StructuredTaskScopePREVIEW<T, R, R_X extends Throwable>
public static sealed interface StructuredTaskScope.Configuration
Configuration is a preview API of the Java platform.
Programs can only use Configuration when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Represents the configuration for a StructuredTaskScope.

The configuration for a StructuredTaskScope consists of a ThreadFactory to create threads, an optional name for the scope, and an optional timeout. The name is intended for monitoring and management purposes.

Creating a StructuredTaskScope with the open(UnaryOperator)PREVIEW or open(Joiner, UnaryOperator)PREVIEW method allows a different configuration to be used. The operator specified to the open method is applied to the default configuration and returns the configuration for the StructuredTaskScope under construction. The operator can use the with- prefixed methods defined here to specify the components of the configuration to use.

Unless otherwise specified, passing a null argument to a method in this class will cause a NullPointerException to be thrown.

Since:
25

Method Summary

Modifier and Type Method Description
StructuredTaskScope.ConfigurationPREVIEW withName(String name)
Returns a new Configuration object with the given scope name.
StructuredTaskScope.ConfigurationPREVIEW withThreadFactory(ThreadFactory threadFactory)
Returns a new Configuration object with the given thread factory.
StructuredTaskScope.ConfigurationPREVIEW withTimeout(Duration timeout)
Returns a new Configuration object with the given timeout.

Method Details

withThreadFactory

StructuredTaskScope.ConfigurationPREVIEW withThreadFactory(ThreadFactory threadFactory)
Returns a new Configuration object with the given thread factory. The other components are the same as this object. The thread factory is used by a scope to create threads when forkingPREVIEW subtasks.
API Note:
The thread factory will typically create virtual threads, maybe with thread names for monitoring purposes, an uncaught exception handler, or other properties configured.
Parameters:
threadFactory - the thread factory
Returns:
a new Configuration object with the given thread factory
See Also:
  • StructuredTaskScope.fork(Callable)PREVIEW

withName

StructuredTaskScope.ConfigurationPREVIEW withName(String name)
Returns a new Configuration object with the given scope name. The other components are the same as this object. A scope is optionally named for the purposes of monitoring and management.
Parameters:
name - the name
Returns:
a new Configuration object with the given scope name

withTimeout

StructuredTaskScope.ConfigurationPREVIEW withTimeout(Duration timeout)
Returns a new Configuration object with the given timeout. The other components are the same as this object.
API Note:
Applications using deadlines, expressed as an Instant, can use Duration.between(Instant.now(), deadline) to compute the timeout for this method.
Parameters:
timeout - the timeout
Returns:
a new Configuration object with the given timeout
See Also:
  • StructuredTaskScope.join()PREVIEW
  • StructuredTaskScope.CancelledByTimeoutExceptionPREVIEW

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API