Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hint to request virtual threads #349

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,32 @@
*/
int maxAsync() default -1;

/**
* <p>Indicates whether this executor is requested to
* create {@link Thread#isVirtual() virtual} threads
* for tasks that do not run inline.</p>
*
* <p>When {@code true}, the executor can create
* virtual threads if it is capable of doing so
* and if the request is not overridden by vendor-specific
* configuration that restricts the use of virtual threads.</p>
*
* <p>The default is {@code false}, indicating that the
* executor must not create virtual threads.</p>
*
* <p>It should be noted that some tasks, such as
* completion stage actions, can run inline on an existing
* thread in response to events such as the completion of
* another stage or a join operation on the completion stage.
* In situations such as these, the executor does not control
* the type of thread that is used to run the task.</p>
*
* @return {@code true} if the executor can create virtual threads,
* otherwise {@code false}.
* @since 3.1
*/
boolean virtual() default false;

/**
* Enables multiple <code>ManagedExecutorDefinition</code>
* annotations on the same type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,32 @@
*/
int maxAsync() default -1;

/**
* <p>Indicates whether this executor is requested to
* create {@link Thread#isVirtual() virtual} threads
* for tasks that do not run inline.</p>
*
* <p>When {@code true}, the executor can create
* virtual threads if it is capable of doing so
* and if the request is not overridden by vendor-specific
* configuration that restricts the use of virtual threads.</p>
*
* <p>The default is {@code false}, indicating that the
* executor must not create virtual threads.</p>
*
* <p>It should be noted that some tasks, such as
* completion stage actions, can run inline on an existing
* thread in response to events such as the completion of
* another stage or a join operation on the completion stage.
* In situations such as these, the executor does not control
* the type of thread that is used to run the task.</p>
*
* @return {@code true} if the executor can create virtual threads,
* otherwise {@code false}.
* @since 3.1
*/
boolean virtual() default false;

/**
* Enables multiple <code>ManagedScheduledExecutorDefinition</code>
* annotations on the same type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Contributors to the Eclipse Foundation
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -129,6 +129,26 @@
*/
int priority() default Thread.NORM_PRIORITY;

/**
* <p>Indicates whether this thread factory is requested to
* create {@link Thread#isVirtual() virtual} threads.</p>
*
* <p>When {@code true}, the thread factory can create
* virtual threads if it is capable of doing so
* and if the request is not overridden by vendor-specific
* configuration that restricts the use of virtual threads.</p>
*
* <p>The default is {@code false}, indicating that the
* thread factory must not create virtual threads.
* When {@code false}, the thread factory always creates
* platform threads.</p>
*
* @return {@code true} if the thread factory is requested to
* create virtual threads, otherwise {@code false}.
* @since 3.1
*/
boolean virtual() default false;

/**
* Enables multiple <code>ManagedThreadFactoryDefinition</code>
* annotations on the same type.
Expand Down