Beispiel #1
0
 public void destroy() {
   restartingStateListener.cancel();
   server.removeStateListener(restartingStateListener);
   server.removeStateListener(this);
   server.stop();
   server.destroy();
 }
Beispiel #2
0
 @Override
 public void stateChanged(DOFServer server, State state) {
   // Called when the status of the connectToCloud DOFConnection changes
   String msg = " is started";
   if (state.isStarted())
     statusTracker.setStatus(server.getState().getName(), StatusTracker.Status.Ok);
   else {
     msg = " is stopped";
     statusTracker.setStatus(server.getState().getName(), StatusTracker.Status.Warn);
   }
   log.info("\nserver " + server.getState().getName() + msg);
 }
Beispiel #3
0
  public ServerHelper(
      StatusTracker statusTracker, DOF dof, DOFServer.Config serverConfig, int timeout) {
    log = LoggerFactory.getLogger(getClass());
    this.statusTracker = statusTracker;
    server = dof.createServer(serverConfig);

    restartingStateListener = new RestartingStateListener();
    restartingStateListener.setMinimumDelay(1000);
    restartingStateListener.setMaximumDelay(30000);
    //        server.addStateListener(restartingStateListener);
    server.addStateListener(this);
    server.beginStart(timeout);
  }
Beispiel #4
0
 /* *************************************************************************
  * DOFServer.StateListener implementation
  **************************************************************************/
 @Override
 public void removed(DOFServer server, DOFException exception) {
   statusTracker.removeStatus(server.getState().getName());
 }
Beispiel #5
0
 public void addListener(DOFServer.StateListener listener) {
   server.addStateListener(listener);
 }
Beispiel #6
0
 public boolean isStarted() {
   return server.isStarted();
 }