Interface VirtualThreads.Configurable
- All Known Implementing Classes:
DelegatingThreadPool, ExecutorThreadPool, MonitoredQueuedThreadPool, QueuedThreadPool, VirtualThreadPool
- Enclosing class:
VirtualThreads
public static interface VirtualThreads.Configurable
Implementations of this interface can be configured to use virtual threads.
Whether virtual threads are actually used depends on whether the runtime
supports virtual threads and, if the runtime supports them, whether they are
configured to be used via setVirtualThreadsExecutor(Executor).
-
Method Summary
Modifier and TypeMethodDescriptiondefault Executordefault booleanDeprecated, for removal: This API element is subject to removal in a future version.default voidsetUseVirtualThreads(boolean useVirtualThreads) Deprecated, for removal: This API element is subject to removal in a future version.usesetVirtualThreadsExecutor(Executor)insteaddefault voidsetVirtualThreadsExecutor(Executor executor)
-
Method Details
-
getVirtualThreadsExecutor
- Returns:
- the
Executorto use to execute tasks in virtual threads
-
setVirtualThreadsExecutor
- Parameters:
executor- theExecutorto use to execute tasks in virtual threads- Throws:
UnsupportedOperationException- if the runtime does not support virtual threads- See Also:
-
isUseVirtualThreads
Deprecated, for removal: This API element is subject to removal in a future version.usegetVirtualThreadsExecutor()instead- Returns:
- whether to use virtual threads
-
setUseVirtualThreads
Deprecated, for removal: This API element is subject to removal in a future version.usesetVirtualThreadsExecutor(Executor)instead- Parameters:
useVirtualThreads- whether to use virtual threads- Throws:
UnsupportedOperationException- if the runtime does not support virtual threads- See Also:
-
getVirtualThreadsExecutor()instead