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

Correcting the behavior of gracefulShutdown #1302

Merged

Conversation

vincentvilo-aws
Copy link
Contributor

Issue #, if available: #616

Description of changes: This PR corrects the behavior of Scheduler's gracefulShutdown.

Originally, calling Scheduler.startGracefulShutdown() would return false because the CountDownLatch used to track the shutdowns of the record processors was never decremented. To address this issue, the CountDownLatch is decremented within the ConsumerTask of the ShuttingDownState (see ShutdownTask.java). The ShutdownCompleteState is now used as a terminal state and contains no associated ConsumerTask.

Also, another CountDownLatch was introduced to the Scheduler to ensure that its finalShutdown()method is returned before the startGracefulShutdown() returns.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vincentvilo-aws vincentvilo-aws merged commit 7f1f243 into awslabs:master Apr 3, 2024
1 check passed
akidambisrinivasan pushed a commit to akidambisrinivasan/amazon-kinesis-client that referenced this pull request Apr 29, 2024
* modify ShutdownTask to call shutdownComplete for graceful shutdown

* add test to verify ShutdownTask succeeds regardless of shutdownNotification

* change access level for finalShutdownLatch to NONE

* remove unused variable in GracefulShutdownCoordinator

* make comment more concise

* move waitForFinalShutdown method into GracefulShutdownCoordinator class

* cleanup call method of GracefulShutdownCoordinator

* modify waitForFinalShutdown to throw InterruptedException
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