Skip to content

Port Netflix/Hystrix#1976 remove canceled timer tasks#4

Open
amrith92 wants to merge 1 commit into
masterfrom
port-netflix-1976-remove-on-cancel-policy
Open

Port Netflix/Hystrix#1976 remove canceled timer tasks#4
amrith92 wants to merge 1 commit into
masterfrom
port-netflix-1976-remove-on-cancel-policy

Conversation

@amrith92

Copy link
Copy Markdown
Owner

Ports Netflix#1976 into this fork.\n\nThe upstream change enables ScheduledThreadPoolExecutor#setRemoveOnCancelPolicy(true) for HystrixTimer so canceled timeout tasks are removed from the scheduler queue instead of remaining until their delay elapses.\n\nUpstream reference: https://github.com/Netflix/Hystrix/pull/1976\nOriginal commit: 2f4520d\n\nVerification:\n- PASS: JAVA_HOME=/Users/amrith/.sdkman/candidates/java/17.0.6-tem ./gradlew :hystrix-core:test --tests com.netflix.hystrix.util.HystrixTimerTest --no-daemon\n- NOTE: ./gradlew :hystrix-core:test --no-daemon failed under Java 21 before compilation because Gradle/Groovy cannot parse class file major version 65. Re-run under Java 17 progressed into tests but hung in the broader test task, so it was stopped and replaced with the focused HystrixTimer test above.\n

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d9bfe87e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

executor = new ScheduledThreadPoolExecutor(coreSize, threadFactory);
executor.setRemoveOnCancelPolicy(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve Java 6 timer compatibility

This call uses ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy, which is only available starting in Java 7, but the project still documents support for “Java 6 or later” in README.md:140. On a Java 6 runtime, initializing HystrixTimer now throws NoSuchMethodError here before initialized is set, leaving the singleton executor non-null but uninitialized; later timer use can then spin in startThreadIfNeeded() instead of recovering. Please either avoid this API on Java 6 (for example by reflective/version-gated use) or explicitly drop Java 6 support.

Useful? React with 👍 / 👎.

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.

1 participant