/** * @throws NoSuchElementException * if none found */ Iterable<? extends NodeMetadata> nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( Predicate<NodeMetadata> filter) { Iterable<? extends NodeMetadata> nodes = nodesMatchingFilterAndNotTerminated(filter); if (Iterables.size(nodes) == 0) throw new NoSuchElementException("no nodes matched filter: " + filter); return nodes; }
/** * @throws NoSuchElementException * if none found */ Iterable<? extends NodeMetadata> nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( Predicate<NodeMetadata> filter) { Iterable<? extends NodeMetadata> nodes = nodesMatchingFilterAndNotTerminated(filter); if (Iterables.size(nodes) == 0) throw new NoSuchElementException("no nodes matched filter: " + filter); return nodes; }
/** * @throws NoSuchElementException * if none found */ Iterable<? extends NodeMetadata> nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( Predicate<? super NodeMetadata> filter) { Iterable<? extends NodeMetadata> nodes = nodesMatchingFilterAndNotTerminated(filter); if (Iterables.isEmpty(nodes)) throw new NoSuchElementException("no nodes matched filter: " + filter); return nodes; }
/** * @throws NoSuchElementException * if none found */ Iterable<? extends NodeMetadata> nodesMatchingFilterAndNotTerminatedExceptionIfNotFound( Predicate<? super NodeMetadata> filter) { Iterable<? extends NodeMetadata> nodes = nodesMatchingFilterAndNotTerminated(filter); if (Iterables.isEmpty(nodes)) throw new NoSuchElementException("no nodes matched filter: " + filter); return nodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> rebootNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> rebooting nodes matching(%s)", filter); Set<NodeMetadata> rebootNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { rebootNode(from.getId()); return from; } public String toString() { return "rebootNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "rebootNodesMatching(" + filter + ")")); logger.debug("<< rebooted(%d)", rebootNodes.size()); return rebootNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> resumeNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> resuming nodes matching(%s)", filter); Set<NodeMetadata> resumeNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { resumeNode(from.getId()); return from; } public String toString() { return "resumeNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "resumeNodesMatching(" + filter + ")")); logger.debug("<< resumed(%d)", resumeNodes.size()); return resumeNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> suspendNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> suspending nodes matching(%s)", filter); Set<NodeMetadata> suspendNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { suspendNode(from.getId()); return from; } public String toString() { return "suspendNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "suspendNodesMatching(" + filter + ")")); logger.debug("<< suspended(%d)", suspendNodes.size()); return suspendNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> rebootNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> rebooting nodes matching(%s)", filter); Set<NodeMetadata> rebootNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { rebootNode(from.getId()); return from; } public String toString() { return "rebootNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "rebootNodesMatching(" + filter + ")")); logger.debug("<< rebooted(%d)", rebootNodes.size()); return rebootNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> resumeNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> resuming nodes matching(%s)", filter); Set<NodeMetadata> resumeNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { resumeNode(from.getId()); return from; } public String toString() { return "resumeNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "resumeNodesMatching(" + filter + ")")); logger.debug("<< resumed(%d)", resumeNodes.size()); return resumeNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> suspendNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> suspending nodes matching(%s)", filter); Set<NodeMetadata> suspendNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { suspendNode(from.getId()); return from; } public String toString() { return "suspendNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "suspendNodesMatching(" + filter + ")")); logger.debug("<< suspended(%d)", suspendNodes.size()); return suspendNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> destroying nodes matching(%s)", filter); Set<NodeMetadata> destroyNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { doDestroyNode(from.getId()); return from; } public String toString() { return "destroyNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "destroyNodesMatching(" + filter + ")")); logger.debug("<< destroyed(%d)", destroyNodes.size()); cleanUpIncidentalResourcesOfDeadNodes(destroyNodes); return destroyNodes; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> destroying nodes matching(%s)", filter); Set<NodeMetadata> set = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { doDestroyNode(from.getId()); return from; } public String toString() { return "destroyNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "destroyNodesMatching(" + filter + ")")); logger.debug("<< destroyed(%d)", set.size()); cleanUpIncidentalResourcesOfDeadNodes(set); return set; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> destroying nodes matching(%s)", filter); Set<NodeMetadata> set = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { doDestroyNode(from.getId()); return from; } public String toString() { return "destroyNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "destroyNodesMatching(" + filter + ")")); logger.debug("<< destroyed(%d)", set.size()); cleanUpIncidentalResourcesOfDeadNodes(set); return set; }
/** * {@inheritDoc} */ @Override public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<? super NodeMetadata> filter) { logger.debug(">> destroying nodes matching(%s)", filter); Set<NodeMetadata> destroyNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { // TODO make an async interface instead of re-wrapping @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { doDestroyNode(from.getId()); return from; } public String toString() { return "destroyNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "destroyNodesMatching(" + filter + ")")); logger.debug("<< destroyed(%d)", destroyNodes.size()); cleanUpIncidentalResourcesOfDeadNodes(destroyNodes); return destroyNodes; }