Skip to content

Commit

Permalink
Move wait after the interrupt (#978)
Browse files Browse the repository at this point in the history
* Move wait after the interrupt

* Bump version
  • Loading branch information
hshukla authored Jan 19, 2024
1 parent 335f651 commit 6f54217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ private synchronized boolean stopEventThread() {
// interrupt the thread if it's not gracefully shutdown
CoordinatorEventProcessor eventThread = getEventThread();
while (eventThread.isAlive()) {
// Waits to acquire the Coordinator object for a maximum of _heartbeat period.
// The time bound waiting prevents the caller thread to not infinitely wait if
// the event thread is already shutdown.
waitForNotificationFromEventThread(_heartbeatPeriod);
try {
_log.info("Attempting to interrupt the event thread.");
eventThread.interrupt();
// Waits to acquire the Coordinator object for a maximum of _heartbeat period.
// The time bound waiting prevents the caller thread to not infinitely wait if
// the event thread is already shutdown.
waitForNotificationFromEventThread(_heartbeatPeriod);
eventThread.join(EVENT_THREAD_SHORT_JOIN_TIMEOUT);
} catch (InterruptedException e) {
_log.warn("Exception caught while interrupting the event thread", e);
Expand Down Expand Up @@ -2257,6 +2257,7 @@ private void populateDatastreamDestinationFromExistingDatastream(Datastream data
// be waiting on acquiring access on the Coordinator object.
// We are only calling notify on the synchronized Coordinator Object's ("this") waiting threads.
// Suppressing the Naked_Notify warning on this.
@VisibleForTesting
protected synchronized void notifyThreadsWaitingForCoordinatorObjectSynchronization() {
_coordinatorEventThreadExiting = true;
this.notifyAll();
Expand Down
2 changes: 1 addition & 1 deletion gradle/maven.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
allprojects {
version = "5.5.1-SNAPSHOT"
version = "5.5.1"
}

subprojects {
Expand Down

0 comments on commit 6f54217

Please sign in to comment.