private void shutdownSamp() { sampMonitorHandle.cancel(true); sampClient.setActive(false); sampClient = null; if (hub != null) { hub.shutdown(); } }
private void startSamp() { logger.log(Level.INFO, "Initializing Hub Connector"); sampClient = new HubConnector(sampClientProfile); sampClient.declareMetadata(metadata); sampClient.declareSubscriptions(sampClient.computeSubscriptions()); sampClient.setActive(true); Runnable sampMonitor = new Runnable() { @Override public void run() { monitorSampOnce(); } }; if (resourceServer != null) { resourceServer.start(); logger.log(Level.INFO, "Starting SAMP resource server"); } logger.log(Level.INFO, "Starting SAMP monitor thread"); sampMonitorHandle = executor.scheduleAtFixedRate(sampMonitor, 0, 3, TimeUnit.SECONDS); }