Example #1
0
 public void shutdown() {
   if (!started) {
     throw new IllegalStateException(
         "Service was not started, it does not make sense to shut it down");
   }
   shutdownSamp();
   shutdownSherpa();
   executor.shutdown();
   started = false;
 }
Example #2
0
 private void startSherpa() {
   logger.log(Level.INFO, "Starting Sherpa monitor thread");
   Runnable sherpaMonitor =
       new Runnable() {
         @Override
         public void run() {
           monitorSherpaOnce();
         }
       };
   sherpaMonitorHandle = executor.scheduleAtFixedRate(sherpaMonitor, 0, 3, TimeUnit.SECONDS);
 }
Example #3
0
 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);
 }