@Override public void start(Collection<? extends Location> locations) { log.info("Starting entity "+this+" at "+locations); // essentially does StartableMethods.start(this, locations), // but optionally filters locations for each child LocationsFilter filter = getConfig(LOCATIONS_FILTER); Iterable<Entity> startables = filterStartableManagedEntities(getChildren()); if (startables == null || Iterables.isEmpty(startables)) return; List<Task<?>> tasks = Lists.newArrayList(); for (final Entity entity : startables) { Collection<? extends Location> l2 = locations; if (filter!=null) { l2 = filter.filterForContext(new ArrayList<Location>(locations), entity); log.debug("Child "+entity+" of "+this+" being started in filtered location list: "+l2); } tasks.add( Entities.invokeEffectorWithArgs(this, entity, Startable.START, l2) ); } for (Task<?> t: tasks) t.getUnchecked(); }
@Override public void run() { try { Entities.invokeEffectorWithArgs(entity, entity, DynamicCluster.REPLACE_MEMBER, event.getSource().getId()).get(); consecutiveReplacementFailureTimes.clear(); } catch (Exception e) { // FIXME replaceMember fails if stop fails on the old node; should resolve that more gracefully than this if (e.toString().contains("stopping") && e.toString().contains(event.getSource().getId())) { LOG.info("ServiceReplacer: ignoring error reported from stopping failed node "+event.getSource()); return; } onReplacementFailed("Replace failure (error "+e+") at "+entity+": "+event.getValue()); } }