Patch for Github issue #524 #526
Open
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 patches the Github issue #524
This pull request improves the shutdown process for the
AnalyticsClientby ensuring that all messages are properly processed before shutting down executors. The changes address a potential race condition during shutdown and add better error handling for task submission failures.Shutdown process improvements:
Future<?> looperFutureto track the completion of theLooperthread, allowing the shutdown process to wait for the looper to finish processing all messages before shutting down executors. This prevents a race condition where the network executor could be shut down before all batches are submitted.waitForLooperCompletion()method that waits (with timeout) for the looper to finish, logs completion or errors, and cancels the looper if it takes too long.Error handling enhancements:
RejectedExecutionExceptionduring shutdown, logging the error and notifying callbacks of the failure if the batch cannot be submitted.Dependency updates:
FutureandRejectedExecutionExceptionto support the new shutdown and error handling logic.