public synchronized void registerActivity(final ServerActivity activity) { this.activities.add(activity); if(state != State.RUNNING) { //if the activity is added when we are not running we just immediately suspend it //this should only happen at boot, so there should be no outstanding requests anyway activity.suspended(() -> { }); } }
state = State.SUSPENDING; for (ServerActivity activity : activities) { activity.suspended(SuspendController.this.listener); activity.preSuspend(cb);
public synchronized void resume() { if (state == State.RUNNING) { return; } ServerLogger.ROOT_LOGGER.resumingServer(); if (timer != null) { timer.cancel(); timer = null; } for(OperationListener listener: new ArrayList<>(operationListeners)) { listener.cancelled(); } for (ServerActivity activity : activities) { try { activity.resume(); } catch (Exception e) { ServerLogger.ROOT_LOGGER.failedToResume(activity, e); } } state = State.RUNNING; }
state = State.SUSPENDING; for (ServerActivity activity : activities) { activity.suspended(SuspendController.this.listener); activity.preSuspend(cb);
public synchronized void resume() { if (state == State.RUNNING) { return; } ServerLogger.ROOT_LOGGER.resumingServer(); if (timer != null) { timer.cancel(); timer = null; } for(OperationListener listener: new ArrayList<>(operationListeners)) { listener.cancelled(); } for (ServerActivity activity : activities) { try { activity.resume(); } catch (Exception e) { ServerLogger.ROOT_LOGGER.failedToResume(activity, e); } } state = State.RUNNING; }
public synchronized void registerActivity(final ServerActivity activity) { this.activities.add(activity); if(state != State.RUNNING) { //if the activity is added when we are not running we just immediately suspend it //this should only happen at boot, so there should be no outstanding requests anyway activity.suspended(() -> { }); } }