/** * Unregister a {@link Node} with the {@link NodeMainExecutor}. * * @param node * the {@link Node} to unregister */ private void unregisterNode(Node node) { node.removeListeners(); connectedNodes.get(node.getName()).remove(node); nodeMains.remove(node); } }
/** * @return the current {@link SystemState} */ public SystemState getSystemState() { Response<SystemState> result = masterClient.getSystemState(caller.getName()); return result.getResult(); } }
/** * Trap and log any exceptions while shutting down the supplied {@link Node}. * * @param node * the {@link Node} to shut down */ private void safelyShutdownNode(Node node) { boolean success = true; try { node.shutdown(); } catch (Exception e) { // Ignore spurious errors during shutdown. log.error("Exception thrown while shutting down node.", e); // We don't expect any more callbacks from a node that throws an exception // while shutting down. So, we unregister it immediately. unregisterNode(node); success = false; } if (success) { log.info("Shutdown successful."); } }
/** * @param serviceName * the name of the {@link ServiceServer} to look up * @return the {@link URI} of the {@link ServiceServer} with the given name */ public URI lookupService(String serviceName) { Response<URI> result = masterClient.lookupService(caller.getName(), serviceName); return result.getResult(); }
/** * @return the {@link URI} of the {@link MasterServer} */ public URI getUri() { Response<URI> response = masterClient.getUri(caller.getName()); return response.getResult(); }
/** * @return a {@link List} of {@link TopicType}s known by the master */ public List<TopicType> getTopicTypes() { Response<List<TopicType>> result = masterClient.getTopicTypes(caller.getName()); return result.getResult(); }
/** * @param nodeName * the name of the {@link Node} to lookup * @return the {@link URI} of the {@link Node} with the given name */ public URI lookupNode(String nodeName) { Response<URI> response = masterClient.lookupNode(caller.getName(), nodeName); return response.getResult(); }