Beispiel #1
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);
 }
Beispiel #2
0
 public void addMessageHandler(MessageHandler handler) {
   sampClient.addMessageHandler(handler);
   if (sampClientProfile.isHubRunning()) {
     sampClient.declareSubscriptions(sampClient.computeSubscriptions());
   }
 }