@Override public String toString() { return "ClientConnectionResponse{server=" + getServer() + "}"; }
@Override public ServerLocation findServer(Set excludedServers) { if (PoolImpl.TEST_DURABLE_IS_NET_DOWN) { return null; } ClientConnectionRequest request = new ClientConnectionRequest(excludedServers, serverGroup); ClientConnectionResponse response = (ClientConnectionResponse) queryLocators(request); if (response == null) { throw new NoAvailableLocatorsException( "Unable to connect to any locators in the list " + locators); } return response.getServer(); }
@Override public ServerLocation findReplacementServer(ServerLocation currentServer, Set/* <ServerLocation> */ excludedServers) { if (PoolImpl.TEST_DURABLE_IS_NET_DOWN) { return null; } ClientReplacementRequest request = new ClientReplacementRequest(currentServer, excludedServers, serverGroup); ClientConnectionResponse response = (ClientConnectionResponse) queryLocators(request); if (response == null) { throw new NoAvailableLocatorsException( "Unable to connect to any locators in the list " + locators); } return response.getServer(); }
@Override public ServerLocation findServer(Set<ServerLocation> excludedServers, String serverGroup) { security.authorize(CLUSTER, READ, ALL, ALL); InternalLocator internalLocator = (InternalLocator) locator; // In order to ensure that proper checks are performed on the request we will use // the locator's processRequest() API. We assume that all servers have Protobuf // enabled. ClientConnectionRequest clientConnectionRequest = new ClientConnectionRequest(excludedServers, serverGroup); ClientConnectionResponse connectionResponse = (ClientConnectionResponse) internalLocator .getServerLocatorAdvisee().processRequest(clientConnectionRequest); ServerLocation serverLocation = null; if (connectionResponse != null && connectionResponse.hasResult()) { serverLocation = connectionResponse.getServer(); } return serverLocation; } }