public ActivationState getActivationState() throws NotAvailableException { return (ActivationState) getDataField(FIELD_ACTIVATION_STATE); }
@Override public void enable() throws CouldNotPerformException, InterruptedException { try { synchronized (enablingLock) { super.enable(); if (detectAutostart()) { setActivationState(ActivationState.newBuilder().setValue(ActivationState.State.ACTIVE).build()).get(); } else { setActivationState(ActivationState.newBuilder().setValue(ActivationState.State.DEACTIVE).build()).get(); } } } catch (ExecutionException ex) { throw new CouldNotPerformException("Could not diable " + this, ex); } }
try (ClosableDataBuilder<MB> dataBuilder = getDataBuilder(this)) { try { if (activation.getValue() == ActivationState.State.ACTIVE) { stop();
private boolean detectAutostart() { try { return isAutostartEnabled(); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new NotSupportedException("autostart", (AbstractExecutableController) this, (Throwable) ex), logger, LogLevel.WARN); return true; } }
@Override public void disable() throws CouldNotPerformException, InterruptedException { try { synchronized (enablingLock) { executing = false; setActivationState(ActivationState.newBuilder().setValue(ActivationState.State.DEACTIVE).build()).get(); super.disable(); } } catch (ExecutionException ex) { throw new CouldNotPerformException("Could not diable " + this, ex); } }