You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use KCL 1.6.3, but I cannot stop the cw-metrics-publisher thread cleanly. Or more specifically, I can't tell when the cw-metrics-publisher thread has finished shutting down, so that I can then shutdown the AWSCloudWatch instance.
I am launching my Worker object in its own thread:
Future<?> task = executor.submit(worker);
This means that I can shutdown the worker by executing:
executor.shutdown();
worker.shutdown();
if (!executor.awaitTermination(... timeout ...)) {
executor.shutdownNow();
}
However, this only guarantees that CWMetricsFactory.shutdown() has been invoked. It does not wait for CWPublisherRunnable<>.isShutdown() to become true. Nor do I have access to the CWMetricsFactory.publicationThread field so that I can poll its isAlive() method. (Not without hacking my way in using reflection, anyway).
I think the CWPublisherRunnable<> should finish executing before the Worker exits, and so I've tweaked CWMetricsFactory.shutdown() locally as follows:
public void shutdown() {
runnable.shutdown();
try {
publicationThread.join();
} catch (InterruptedException e) {
throw new AbortedException(e.getMessage(), e);
}
}
I'm trying to use KCL 1.6.3, but I cannot stop the
cw-metrics-publisher
thread cleanly. Or more specifically, I can't tell when thecw-metrics-publisher
thread has finished shutting down, so that I can then shutdown theAWSCloudWatch
instance.I am launching my
Worker
object in its own thread:This means that I can shutdown the worker by executing:
However, this only guarantees that
CWMetricsFactory.shutdown()
has been invoked. It does not wait forCWPublisherRunnable<>.isShutdown()
to becometrue
. Nor do I have access to theCWMetricsFactory.publicationThread
field so that I can poll itsisAlive()
method. (Not without hacking my way in using reflection, anyway).I think the
CWPublisherRunnable<>
should finish executing before theWorker
exits, and so I've tweakedCWMetricsFactory.shutdown()
locally as follows:See pull request #81.
The text was updated successfully, but these errors were encountered: