CAMEL-22949: Migrate components from Thread.sleep() to Camel's Task API#21215
Merged
gnodet merged 7 commits intoapache:mainfrom Feb 2, 2026
Merged
CAMEL-22949: Migrate components from Thread.sleep() to Camel's Task API#21215gnodet merged 7 commits intoapache:mainfrom
gnodet merged 7 commits intoapache:mainfrom
Conversation
Replace Thread.sleep() with Tasks.foregroundTask() for subscription retry backoff delay in SubscriptionHelper. This provides better integration with Camel's lifecycle management and proper shutdown handling.
Replace Thread.sleep() with Tasks.foregroundTask() for query polling delay in Athena2QueryHelper. This provides better integration with Camel's lifecycle management and proper shutdown handling.
Replace Thread.sleep() with Tasks.foregroundTask() for reconnection backoff delay in ZooKeeperConsumer. This provides better integration with Camel's lifecycle management and proper shutdown handling.
Replace Thread.sleep() with Tasks.foregroundTask() for error recovery delay in HazelcastSedaConsumer. This provides better integration with Camel's lifecycle management and proper shutdown handling.
Replace Thread.sleep() with Tasks.foregroundTask() to avoid busy-waiting when consumer is suspended in IggyFetchRecords. This provides better integration with Camel's lifecycle management and proper shutdown handling.
…delays The previous implementation used withInterval() which caused the task to complete immediately without any delay. For a simple one-time delay, we need to use withInitialDelay() which delays before the first iteration.
The ForegroundTask only sleeps between iterations, not before the first iteration. For a simple one-time delay, we need to use withInitialDelay() which delays before the first iteration. This fixes test failures where the delay was not happening as expected.
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🤖 CI automation will test this PR automatically. 🐫 Apache Camel Committers, please review the following items:
|
Croway
approved these changes
Feb 2, 2026
davsclaus
approved these changes
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses CAMEL-22949 by migrating multiple components from using
Thread.sleep()to Camel's Task API for better lifecycle management and integration with Camel's runtime.Components Migrated
Key Changes
Thread.sleep()calls withTasks.foregroundTask()usingIterationBudgetwithInitialDelay()for one-time delays (notwithInterval()which only applies between iterations)Related Issues
Testing
-Psourcecheck)MIGRATION_THREAD_SLEEP_TO_TASK_API.md