@Override
	public void run() {
		LOG.debug("Starting NatsMonitor");
		MsgHandler handler = new MsgHandler() { };
		int ping_interval = (System.getenv("NATS_PING_INTERVAL") == null) 
				? DEFAULT_PING_INTERVAL : Integer.parseInt(System.getenv("NATS_PING_INTERVAL"));
		Resource resource = null;
		while (true) {
			try {
				Thread.sleep(ping_interval);
				for(Enumeration<Resource> e = resources.elements(); e.hasMoreElements();) {
					resource = e.nextElement();
					if ((resource != null) && (resource.isConnected())) { resource.sendPing(handler); }
				}
			} catch(IOException ioe) {
				LOG.debug(ioe.getMessage() + ", " + "Failed pinging resoure(" + 
						resource.getResourceId() + ")");
				Subscription.removeSubscribers(resource.getResourceId());
				this.removeResource(resource.getResourceId());
			} catch(InterruptedException ie) {
				break;
			}
		}
		LOG.debug("Stopping NatsMonitor");
	}