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; }