public CompletableFuture<List<NodeUri>> getControllerServerList() { if (cluster == null) { return Futures.failedFuture(new IllegalStateException("Controller cluster not initialized")); } return CompletableFuture.supplyAsync(() -> { try { return cluster.getClusterMembers().stream() .map(host -> NodeUri.newBuilder().setEndpoint(host.getIpAddr()).setPort(host.getPort()).build()) .collect(Collectors.toList()); } catch (ClusterException e) { // cluster implementation throws checked exceptions which cannot be thrown inside completable futures. throw Exceptions.sneakyThrow(e); } }, executor); }
private void triggerRebalance() throws IOException { //Read the current mapping from the host store and write back the update after rebalancing. try { Map<Host, Set<Integer>> newMapping = segBalancer.rebalance(hostStore.getHostContainersMap(), pravegaServiceCluster.getClusterMembers()); Map<Host, Set<Integer>> oldMapping = hostStore.getHostContainersMap(); hostStore.updateHostContainersMap(newMapping); hostContainerMetrics.updateHostContainerMetrics(oldMapping, newMapping); } catch (ClusterException e) { throw new IOException(e); } }
return cluster.getClusterMembers() .stream() .map(Host::getHostId)
clusterZKInstance1.registerHost(new Host(HOST_2, PORT, null)); assertEquals(HOST_2, nodeAddedQueue.poll(5, TimeUnit.SECONDS)); assertEquals(2, clusterListener.getClusterMembers().size());
when(mockCluster.getClusterMembers()).thenReturn(Collections.singleton(new Host("localhost", 9090, null))); controllerService = new ControllerServiceImpl( new ControllerService(streamStore, hostStore, streamMetadataTasks, streamTransactionMetadataTasks,