Skip to content

Support cancellation of in-flight stack operations in the Automation API - #2246

Open
addu390 wants to merge 3 commits into
pulumi:mainfrom
addu390:feature/java-cancel-stack-automation-api
Open

Support cancellation of in-flight stack operations in the Automation API#2246
addu390 wants to merge 3 commits into
pulumi:mainfrom
addu390:feature/java-cancel-stack-automation-api

Conversation

@addu390

@addu390 addu390 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@addu390
addu390 requested a review from a team as a code owner July 10, 2026 17:19
@addu390

addu390 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@Frassle @iwahbe Whenever you get a chance, I'd really appreciate a review on this one. No hurry, and thanks for your time!

private final Map<CancellationTokenRegistration, Runnable> registrations = new LinkedHashMap<>();
private boolean cancellationRequested;

CancellationToken(boolean canceled) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only ever false? Probably just drop the parameter

* {@link CancellationTokenSource}.
*/
public final class CancellationToken {
private static final CancellationToken NONE = new CancellationToken(false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will accumulate registrations forever, that might be a memory leak that matters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the cancellation state into CancellationTokenSource so the shared none() token no longer stores registrations.

@addu390
addu390 force-pushed the feature/java-cancel-stack-automation-api branch from 3c97214 to ea4131a Compare July 13, 2026 23:35
@addu390
addu390 requested a review from Frassle July 13, 2026 23:36
@addu390

addu390 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Frassle
Not a hurry, addressed the comments, would appreciate a review when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants