protected ListenableFuture<Void> attainState() { return attainState(getDesiredState()); }
private ListenableFuture<Void> attainStateIfOpenedOrReopenFailed() { if (_openComplete || getDesiredState() == State.DELETED) { return attainState(); } else if (_openFailed) { return openAsync(); } return Futures.immediateFuture(null); }
final State currentDesiredState = getDesiredState(); if(desiredState == currentDesiredState && desiredState != state)
@Override public final ListenableFuture<Void> deleteAsync() { final State currentDesiredState = getDesiredState(); if (currentDesiredState == State.DELETED) { return Futures.immediateFuture(null); } Map<String, Object> attributes = Collections.singletonMap(ConfiguredObject.DESIRED_STATE, State.DELETED); ConfiguredObject<?> proxyForValidation = createProxyForValidation(attributes); authoriseSetAttributes(proxyForValidation, attributes); validateChange(proxyForValidation, attributes.keySet()); checkReferencesOnDelete(getHierarchyRoot(this), this); // for DELETED state we should invoke transition method first to make sure that object can be deleted. // If method results in exception being thrown due to various integrity violations // then object cannot be deleted without prior resolving of integrity violations. // The state transition should be disallowed. if(_parent instanceof AbstractConfiguredObject<?>) { ((AbstractConfiguredObject<?>)_parent).validateChildDelete(AbstractConfiguredObject.this); } else if (_parent instanceof AbstractConfiguredObjectProxy) { ((AbstractConfiguredObjectProxy)_parent).validateChildDelete(AbstractConfiguredObject.this); } return deleteNoChecks(); }
final State currentDesiredState = getDesiredState();