/** * Gets the current bootstrap nodes. * * @return the current bootstrap nodes */ public List<BootstrapNodeInfo> getCurrentBootstrapNodes() { List<ChildData> nodesData = bootstrapCache != null ? bootstrapCache .getCurrentData() : new ArrayList<ChildData>(); List<BootstrapNodeInfo> result = new ArrayList<>(nodesData.size()); for (ChildData data : nodesData) { result.add(extractBootstrapServerInfo(data)); } return result; }
/** * Bootstrap updated. * * @param data the data */ protected void bootstrapUpdated(ChildData data) { BootstrapNodeInfo nodeInfo = extractBootstrapServerInfo(data); String bootstrapAddress = constructBootstrapAddress(nodeInfo); bootstrapNodesStartTimes.put(bootstrapAddress, nodeInfo.getTimeStarted()); for (BootstrapNodeListener listener : bootstrapListeners) { listener.onNodeUpdated(nodeInfo); } }
/** * Bootstrap added. * * @param data the data */ protected void bootstrapAdded(ChildData data) { BootstrapNodeInfo nodeInfo = extractBootstrapServerInfo(data); String bootstrapAddress = constructBootstrapAddress(nodeInfo); bootstrapNodesStartTimes.put(bootstrapAddress, nodeInfo.getTimeStarted()); for (BootstrapNodeListener listener : bootstrapListeners) { listener.onNodeAdded(nodeInfo); } }
/** * Bootstrap removed. * * @param data the data */ protected void bootstrapRemoved(ChildData data) { BootstrapNodeInfo nodeInfo = extractBootstrapServerInfo(data); String bootstrapAddress = constructBootstrapAddress(nodeInfo); Long removeTime = nodeInfo.getTimeStarted(); Long updateTime = bootstrapNodesStartTimes.get(bootstrapAddress); if (updateTime == null || removeTime >= updateTime) { for (BootstrapNodeListener listener : bootstrapListeners) { listener.onNodeRemoved(nodeInfo); } } else { LOG.debug("Ignoring [{}] bootstrap removal, as it was before add/update", bootstrapAddress); } }