@Override public int hashCode() { return getId().hashCode(); }
/** override this, adding to the returned value, to supply additional fields to include in the toString */ protected ToStringHelper string() { return Objects.toStringHelper(getClass()).add("id", getId()).add("name", name); }
@Override public boolean equals(Object o) { if (! (o instanceof Location)) { return false; } Location l = (Location) o; return getId().equals(l.getId()); }
public void onManagementStopped() { this.managed = false; if (getManagementContext().isRunning()) { BrooklynStorage storage = ((ManagementContextInternal)getManagementContext()).getStorage(); storage.remove(getId()+"-parent"); storage.remove(getId()+"-children"); storage.remove(getId()+"-creationTime"); storage.remove(getId()+"-hostGeoInfo"); storage.remove(getId()+"-displayName"); storage.remove(getId()+"-config"); } }
recursively(loc, new Predicate<AbstractLocation>() { @Override public boolean apply(AbstractLocation it) { if (shouldSkipUnmanagement(it)) return false; boolean result = unmanageNonRecursiveRemoveFromRecords(it, mode); if (result) { ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId()); if (mode==null) { // ad hoc creation e.g. tests log.debug("Missing transition mode for "+it+" when unmanaging; assuming primary/destroying"); mode = ManagementTransitionMode.guessing(BrooklynObjectManagementMode.MANAGED_PRIMARY, BrooklynObjectManagementMode.NONEXISTENT); } if (mode.wasPrimary()) it.onManagementStopped(); managementContext.getRebindManager().getChangeListener().onUnmanaged(it); if (mode.isDestroying()) recordLocationEvent(it, Lifecycle.DESTROYED); if (managementContext.gc != null) managementContext.gc.onUnmanaged(it); } unmanageNonRecursiveClearItsFields(loc, mode); return result; } });
recursively(loc, new Predicate<AbstractLocation>() { @Override public boolean apply(AbstractLocation it) { ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId()); if (mode==null) { setManagementTransitionMode(it, mode = initialMode);