@Override public Boolean call() throws Exception { LOG.debug("Calling joinCluster effector on {} for {}", firstNode, member); if (member.hasJoinedCluster()) return true; String address = Preconditions.checkNotNull(getNodeAddress(member)); if (Entities.invokeEffectorWithArgs(EtcdClusterImpl.this, firstNode, EtcdNode.JOIN_ETCD_CLUSTER, name, address).blockUntilEnded(timeout)) { Duration.seconds(15).countdownTimer().waitForExpiryUnchecked(); addNode(member, name); return true; } else { return false; } } }
protected void onServerPoolMemberRemoved(final Entity member) { Map<Entity, String> nodes = MutableMap.copyOf(sensors().get(ETCD_CLUSTER_NODES)); Duration timeout = config().get(BrooklynConfigKeys.START_TIMEOUT); String name = nodes.get(member); if (nodes.containsKey(member)) { synchronized (clusterMutex) { Optional<Entity> otherNode = Iterables.tryFind(nodes.keySet(), Predicates.and( Predicates.instanceOf(EtcdNode.class), EntityPredicates.attributeEqualTo(EtcdNode.ETCD_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE), Predicates.not(EntityPredicates.idEqualTo(member.getId())))); if (otherNode.isPresent()) { boolean ended = Entities.invokeEffectorWithArgs(this, otherNode.get(), EtcdNode.LEAVE_ETCD_CLUSTER, name).blockUntilEnded(timeout); if (!ended) { LOG.warn("Timeout invoking leaveCluster for {} on {}", member, otherNode.get()); } } removeNode(member, name); } } }
@Override public void run() { try { Entities.invokeEffectorWithArgs(entity, entity, MemberReplaceable.REPLACE_MEMBER, failedEntity.getId()).get(); consecutiveReplacementFailureTimes.clear(); } catch (Exception e) { if (Exceptions.getFirstThrowableOfType(e, StopFailedRuntimeException.class) != null) { LOG.info("ServiceReplacer: ignoring error reported from stopping failed node "+failedEntity); return; } highlightViolation(violationText+" and replace attempt failed: "+Exceptions.collapseText(e)); onReplacementFailed("Replace failure ("+Exceptions.collapseText(e)+") at "+entity+": "+reason); } } });
@Test public void testInvokeEffectorStartFailing_EntitiesInvoke() { FailingEntity entity = createFailingEntity(); assertTaskFails( Entities.invokeEffectorWithArgs(entity, entity, Startable.START, locs) ); }
log.debug("Child " + entity + " of " + this + " being started in filtered location list: " + l2); tasks.add(Entities.invokeEffectorWithArgs(this, entity, Startable.START, l2));
@Test public void testInvokeEffectorStartWithArgs() { Entities.invokeEffectorWithArgs(app, app, Startable.START, locs).getUnchecked(); Asserts.assertEqualsIgnoringOrder(locs, app.getLocations()); }
if (Entities.invokeEffectorWithArgs(this, child, Startable.START, locations).blockUntilEnded(timeout)) { LOG.debug("Successfully started {} by {}", child, this); } else {
if (Entities.invokeEffectorWithArgs(this, child, Startable.START, locations).blockUntilEnded(timeout)) { LOG.debug("Successfully started {} by {}", child, this); } else {