Skip to content

Commit

Permalink
id: 1150
Browse files Browse the repository at this point in the history
desc: re-add finalizerGuardian method
  • Loading branch information
fcalderonnearsoft committed Mar 21, 2016
1 parent 1103a55 commit 9b5e5c0
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ public boolean isRunning() {
/**
* Used to protect against leaking ExecutorServices and threads if this class is abandoned for GC without shutting down.
*/
@SuppressWarnings("unused")
private final Object finalizerGuardian = new Object() {
protected void finalize() throws Throwable {
if (!executor.isShutdown()) {
logger.warn(HystrixMetricsPoller.class.getSimpleName() + " was not shutdown. Caught in Finalize Guardian and shutting down.");
try {
shutdown();
} catch (Exception e) {
logger.error("Failed to shutdown " + HystrixMetricsPoller.class.getSimpleName(), e);
}
}
};
};

public static interface MetricsAsJsonPollerListener {
public void handleJsonMetric(String json);
Expand Down

0 comments on commit 9b5e5c0

Please sign in to comment.