@Override public ServerLocation getServer() { return endpoint.getLocation(); }
/** return a copy of the list of all server locations */ public Set/* <ServerLocation> */ getAllLocations() { HashSet locations = new HashSet(); for (Iterator itr = connectionMap.keySet().iterator(); itr.hasNext();) { org.apache.geode.cache.client.internal.Endpoint endpoint = (org.apache.geode.cache.client.internal.Endpoint) itr.next(); locations.add(endpoint.getLocation()); } return locations; } }
@Override public ServerLocation getServer() { return getEndpoint().getLocation(); }
@Override public ServerLocation getServer() { return getEndpoint().getLocation(); }
@Override public void endpointNowInUse(Endpoint endpoint) { if (cancelCriterion.isCancelInProgress()) { return; } InternalClientMembership.notifyServerJoined(endpoint.getLocation()); } }
@Override public void endpointNoLongerInUse(Endpoint endpoint) { if (cancelCriterion.isCancelInProgress()) { return; } InternalClientMembership.notifyServerLeft(endpoint.getLocation()); }
@Override public void endpointCrashed(Endpoint endpoint) { if (cancelCriterion.isCancelInProgress()) { return; } InternalClientMembership.notifyServerCrashed(endpoint.getLocation()); }
private Endpoint getMockedEndpoint(ServerLocation serverLocation) { final Endpoint endpoint = mock(Endpoint.class); doReturn(serverLocation).when(endpoint).getLocation(); return endpoint; }
@Override public ClientUpdater createServerToClientConnection(Endpoint endpoint, QueueManager qManager, boolean isPrimary, ClientUpdater failedUpdater) { String clientUpdateName = CacheClientUpdater.CLIENT_UPDATER_THREAD_NAME + " on " + endpoint.getMemberId() + " port " + endpoint.getLocation().getPort(); if (logger.isDebugEnabled()) { logger.debug("Establishing: {}", clientUpdateName); } // Launch the thread CacheClientUpdater updater = connectionConnector.connectServerToClient(endpoint, qManager, isPrimary, failedUpdater, clientUpdateName); return updater; } }
@Override public void run2() { if (endpoint.timeToPing(pingIntervalNanos)) { try { PingOp.execute(pool, endpoint.getLocation()); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Error occurred while pinging server: {} - {}", endpoint.getLocation(), e.getMessage()); } InternalCache cache = GemFireCacheImpl.getInstance(); if (cache != null) { ClientMetadataService cms = cache.getClientMetadataService(); cms.removeBucketServerLocation(endpoint.getLocation()); } // any failure to ping the server should be considered a crash (eg. // socket timeout exception, security exception, failure to connect). pool.getEndpointManager().serverCrashed(endpoint); } } } }
Map<ServerLocation, Endpoint> endpointMapTemp = new HashMap<ServerLocation, Endpoint>(endpointMap); endpoint = endpointMapTemp.remove(endpoint.getLocation()); if (endpoint != null) { endpointMap = Collections.unmodifiableMap(endpointMapTemp); try { Long userId = proxyCache.getUserAttributes().getServerToId().remove(endpoint.getLocation()); if (userId != null) { ++size; logger.debug( "EndpointManagerImpl.removeEndpoint() Removed server {} from {} user's ProxyCache", endpoint.getLocation(), size); Long userId = ua.getServerToId().remove(endpoint.getLocation()); if (userId != null && logger.isDebugEnabled()) { logger.debug( "EndpointManagerImpl.removeEndpoint() Removed server {} from thread local variable", endpoint.getLocation()); endpoint.getLocation().setUserId(-1);
/** * Extend the life of the first expired connection to sl. */ public synchronized void extendLifeOfCnxToServer(ServerLocation sl) { if (!this.allConnections.isEmpty()) { final long now = System.nanoTime(); for (Iterator it = this.allConnections.iterator(); it.hasNext();) { PooledConnection pc = (PooledConnection) it.next(); if (pc.remainingLife(now, lifetimeTimeoutNanos) > 0) { // no more connections whose lifetime could have expired break; // note don't ignore idle connections because they are still connected // } else if (pc.remainingIdle(now, idleTimeoutNanos) <= 0) { // // this con has already idle expired so ignore it } else if (pc.shouldDestroy()) { // this con has already been destroyed so ignore it } else if (sl.equals(pc.getEndpoint().getLocation())) { // we found a connection to whose lifetime we can extend it.remove(); pc.setBirthDate(now); getPoolStats().incLoadConditioningExtensions(); this.allConnections.add(pc); // break so we only do this to the oldest connection break; } } } }
public CacheClientUpdater connectServerToClient(Endpoint endpoint, QueueManager qManager, boolean isPrimary, ClientUpdater failedUpdater, String clientUpdateName) { CacheClientUpdater updater = new CacheClientUpdater(clientUpdateName, endpoint.getLocation(), isPrimary, ds, new ClientSideHandshakeImpl(this.handshake), qManager, endpointManager, endpoint, handshakeTimeout, this.socketCreator); if (!updater.isConnected()) { return null; } updater.setFailedUpdater(failedUpdater); updater.start(); return updater; }