From 44daedf0d904f73a67a1a30de10a324e03843ca0 Mon Sep 17 00:00:00 2001 From: Stu Arnett Date: Thu, 14 May 2015 22:40:33 -0500 Subject: [PATCH] v1.0.2 --- src/main/java/com/emc/rest/smart/PollingDaemon.java | 2 ++ src/main/java/com/emc/rest/smart/SmartClientFactory.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/main/java/com/emc/rest/smart/PollingDaemon.java b/src/main/java/com/emc/rest/smart/PollingDaemon.java index dbfa98a..6885618 100644 --- a/src/main/java/com/emc/rest/smart/PollingDaemon.java +++ b/src/main/java/com/emc/rest/smart/PollingDaemon.java @@ -33,6 +33,8 @@ * Polling thread that will terminate automatically when the application exits */ public class PollingDaemon extends Thread { + public static final String PROPERTY_KEY = "com.emc.rest.smart.pollingDaemon"; + private static final Logger l4j = Logger.getLogger(PollingDaemon.class); private SmartConfig smartConfig; diff --git a/src/main/java/com/emc/rest/smart/SmartClientFactory.java b/src/main/java/com/emc/rest/smart/SmartClientFactory.java index 628781d..db9c1d8 100644 --- a/src/main/java/com/emc/rest/smart/SmartClientFactory.java +++ b/src/main/java/com/emc/rest/smart/SmartClientFactory.java @@ -55,6 +55,9 @@ public static Client createSmartClient(SmartConfig smartConfig, PollingDaemon pollingDaemon = new PollingDaemon(smartConfig); pollingDaemon.start(); + // attach the daemon thread to the client so users can stop it when finished with the client + client.getProperties().put(PollingDaemon.PROPERTY_KEY, pollingDaemon); + return client; }