public void destroy() { restartingStateListener.cancel(); server.removeStateListener(restartingStateListener); server.removeStateListener(this); server.stop(); server.destroy(); }
@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); }
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); }
/* ************************************************************************* * DOFServer.StateListener implementation **************************************************************************/ @Override public void removed(DOFServer server, DOFException exception) { statusTracker.removeStatus(server.getState().getName()); }
public void addListener(DOFServer.StateListener listener) { server.addStateListener(listener); }
public boolean isStarted() { return server.isStarted(); }