public PooledConnection(ConnectionManagerImpl manager, Connection connection) { this.connection = connection; this.endpoint = connection.getEndpoint(); this.birthDate = System.nanoTime(); this.lastAccessed = this.birthDate; }
public QueueConnectionImpl(QueueManagerImpl manager, Connection clientToServer, ClientUpdater updater, FailureTracker failureTracker) { this.manager = manager; this.clientToServerConn.set(clientToServer); this.endpoint = clientToServer.getEndpoint(); this.updater = updater; this.failureTracker = failureTracker; }
void connectionCrashed(Connection con) { // the endpoint has not crashed but this method does all the work // we need to do endpointCrashed(con.getEndpoint()); }
private QueueConnectionImpl initializeQueueConnection(Connection connection, boolean isPrimary, ClientUpdater failedUpdater) { QueueConnectionImpl queueConnection = null; FailureTracker failureTracker = denyList.getFailureTracker(connection.getServer()); try { ClientUpdater updater = factory.createServerToClientConnection(connection.getEndpoint(), this, isPrimary, failedUpdater); if (updater != null) { queueConnection = new QueueConnectionImpl(this, connection, updater, failureTracker); } else { logger.warn("unable to create a subscription connection to server {}", connection.getEndpoint()); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("error creating subscription connection to server {}", connection.getEndpoint(), e); } } if (queueConnection == null) { failureTracker.addFailure(); connection.destroy(); } return queueConnection; }
private Connection getMockedConnection(ServerLocation serverLocation, Endpoint endpoint) throws Exception { /* * Mock the connection to throw a RuntimeException() when connection.Execute() is called, * so that we attempt to notify listeners in the exception handling logic in * OpExecutorImpl.executeWithPossibleReAuthentication() */ final Connection connection = mock(PooledConnection.class); doReturn(serverLocation).when(connection).getServer(); doReturn(endpoint).when(connection).getEndpoint(); doThrow(new RuntimeException()).when(connection).execute(any()); return connection; }
oldCon = this.connection; this.connection = newCon; this.endpoint = newCon.getEndpoint(); this.birthDate = now;
@Override protected Object processResponse(Message msg, Connection con) throws Exception { processAck(msg, "invalidate"); boolean isReply = (msg.getMessageType() == MessageType.REPLY); int partIdx = 0; int flags = 0; if (isReply) { flags = msg.getPart(partIdx++).getInt(); if ((flags & HAS_VERSION_TAG) != 0) { VersionTag tag = (VersionTag) msg.getPart(partIdx++).getObject(); // we use the client's ID since we apparently don't track the server's ID in connections tag.replaceNullIDs((InternalDistributedMember) con.getEndpoint().getMemberId()); this.event.setVersionTag(tag); if (logger.isDebugEnabled()) { logger.debug("received Invalidate response with {}", tag); } } else { if (logger.isDebugEnabled()) { logger.debug("received Invalidate response"); } } } return null; }
conn.destroy(); if (invalidateServer) { endpointManager.serverCrashed(conn.getEndpoint());
@Override public void handle(ChunkedMessage cm) throws Exception { Part part = cm.getPart(0); try { Object o = part.getObject(); if (o instanceof Throwable) { String s = "While performing a remote getAll"; exceptionRef[0] = new ServerOperationException(s, (Throwable) o); } else { VersionedObjectList chunk = (VersionedObjectList) o; chunk.replaceNullIDs(con.getEndpoint().getMemberId()); result.addAll(chunk); } } catch (Exception e) { exceptionRef[0] = new ServerOperationException("Unable to deserialize value", e); } } });
VersionTag tag = (VersionTag) msg.getPart(partIdx++).getObject(); tag.replaceNullIDs((InternalDistributedMember) con.getEndpoint().getMemberId()); this.event.setVersionTag(tag); if (logger.isDebugEnabled()) {
} else { VersionedObjectList chunk = (VersionedObjectList) o; chunk.replaceNullIDs(con.getEndpoint().getMemberId()); result.addAll(chunk);
if (e.getCause() instanceof PutAllPartialResultException) { PutAllPartialResultException cause = (PutAllPartialResultException) e.getCause(); cause.getSucceededKeysAndVersions().replaceNullIDs(con.getEndpoint().getMemberId()); throw cause; } else {
if (this.serverAffinity.get() && this.affinityServerLocation.get() == null) { if (logger.isDebugEnabled()) { logger.debug("setting server affinity to {} server:{}", conn.getEndpoint().getMemberId(), conn.getServer());
serverEntries = new VersionedObjectList(true); ((VersionedObjectList) partObj).replaceNullIDs(con.getEndpoint().getMemberId()); list.clear(); list.add(partObj);
} else { VersionedObjectList chunk = (VersionedObjectList) o; chunk.replaceNullIDs(con.getEndpoint().getMemberId()); result.addAll(chunk);
if (e.getCause() instanceof PutAllPartialResultException) { PutAllPartialResultException cause = (PutAllPartialResultException) e.getCause(); cause.getSucceededKeysAndVersions().replaceNullIDs(con.getEndpoint().getMemberId()); throw cause; } else {
Endpoint endpoint = con.getEndpoint(); if (endpoint != null) { EntryLogger.setSource(endpoint.getMemberId(), "RIGII");
VersionTag tag = (VersionTag) msg.getPart(partIdx++).getObject(); tag.replaceNullIDs((InternalDistributedMember) con.getEndpoint().getMemberId()); this.event.setVersionTag(tag);
VersionTag tag = (VersionTag) msg.getPart(partIdx++).getObject(); assert con != null; // for debugging assert con.getEndpoint() != null; // for debugging assert tag != null; // for debugging tag.replaceNullIDs((InternalDistributedMember) con.getEndpoint().getMemberId()); if (this.clientEvent != null) { this.clientEvent.setVersionTag(tag);