public ServerResponse remoteAddress(RemoteAddress remoteAddress) { this.remoteStreamId = remoteAddress.getStreamId(); return this; }
private SocketAddress deactivateRemote(int nodeId, RemoteAddress remoteAddress) { LOG.info( "Deactivating endpoint for node '{}' with address '{}' on transport '{}'", nodeId, remoteAddress, name); remoteAddressList.deactivate(remoteAddress); return remoteAddress.getAddress(); }
public ServerResponse remoteAddress(RemoteAddress remoteAddress) { this.remoteStreamId = remoteAddress.getStreamId(); return this; }
private SocketAddress deactivateRemote(int nodeId, RemoteAddress remoteAddress) { LOG.info( "Deactivating endpoint for node '{}' with address '{}' on transport '{}'", nodeId, remoteAddress, name); remoteAddressList.deactivate(remoteAddress); return remoteAddress.getAddress(); }
/** * Set the current endpoint address for the node id. It will also register the socket address so a * transport channel will be managed for this endpoint. * * @param nodeId the node id of the endpoint * @param socketAddress the socket address of the endpoint * @return the previous socket address if it has changed, otherwise null */ @Override public SocketAddress setEndpoint(final int nodeId, final SocketAddress socketAddress) { LOG.info( "Registering endpoint for node '{}' with address '{}' on transport '{}'", nodeId, socketAddress, name); final RemoteAddress remoteAddress = remoteAddressList.register(socketAddress); final RemoteAddress lastRemoteAddress = endpoints.put(nodeId, remoteAddress); if (lastRemoteAddress != null && lastRemoteAddress.getStreamId() != remoteAddress.getStreamId()) { return deactivateRemote(nodeId, lastRemoteAddress); } else { return null; } }
private SocketAddress retireRemote(int nodeId, RemoteAddress remoteAddress) { LOG.info( "Retiring endpoint for node '{}' with address '{}' on transport '{}'", nodeId, remoteAddress, name); remoteAddressList.retire(remoteAddress); return remoteAddress.getAddress(); } }
/** * Set the current endpoint address for the node id. It will also register the socket address so a * transport channel will be managed for this endpoint. * * @param nodeId the node id of the endpoint * @param socketAddress the socket address of the endpoint * @return the previous socket address if it has changed, otherwise null */ @Override public SocketAddress setEndpoint(final int nodeId, final SocketAddress socketAddress) { LOG.info( "Registering endpoint for node '{}' with address '{}' on transport '{}'", nodeId, socketAddress, name); final RemoteAddress remoteAddress = remoteAddressList.register(socketAddress); final RemoteAddress lastRemoteAddress = endpoints.put(nodeId, remoteAddress); if (lastRemoteAddress != null && lastRemoteAddress.getStreamId() != remoteAddress.getStreamId()) { return deactivateRemote(nodeId, lastRemoteAddress); } else { return null; } }
private SocketAddress retireRemote(int nodeId, RemoteAddress remoteAddress) { LOG.info( "Retiring endpoint for node '{}' with address '{}' on transport '{}'", nodeId, remoteAddress, name); remoteAddressList.retire(remoteAddress); return remoteAddress.getAddress(); } }
@Override public boolean sendMessage(Integer nodeId, BufferWriter writer) { final RemoteAddress remoteAddress = endpointRegistry.getEndpoint(nodeId); if (remoteAddress != null) { return sendTransportMessage(remoteAddress.getStreamId(), writer); } else { return false; } }
@Override public void onConnectionEstablished(RemoteAddress remoteAddress) { synchronized (monitor) { if (remoteAddress.getAddress().equals(addr)) { monitor.notifyAll(); removeChannelListener(this); } } }
/** * Effect: This remote address/stream is never used again; no channel will every be managed for * this again; if the underlying socket address is registered again, a new remote address is * assigned (+ new stream id) */ @Override public synchronized void retire(RemoteAddress remote) { getByStreamId(remote.getStreamId()).retire(); }
@Override public void onConnectionEstablished(RemoteAddress remoteAddress) { synchronized (monitor) { if (remoteAddress.getAddress().equals(addr)) { monitor.notifyAll(); removeChannelListener(this); } } }
/** * This stream is deactivated until it is registered again; the stream id in this case will remain * stable * * @param remote */ @Override public synchronized void deactivate(RemoteAddress remote) { getByStreamId(remote.getStreamId()).deactivate(); }
public ActorFuture<ClientResponse> sendSyncRequest( int nodeId, RemoteAddress remoteAddress, Duration timeout) { clientTransport.registerEndpoint(nodeId, remoteAddress.getAddress()); return sendSyncRequest(nodeId, timeout); }
/** * Effect: This remote address/stream is never used again; no channel will every be managed for * this again; if the underlying socket address is registered again, a new remote address is * assigned (+ new stream id) */ @Override public synchronized void retire(RemoteAddress remote) { getByStreamId(remote.getStreamId()).retire(); }
public ActorFuture<ClientResponse> sendSyncRequest( int nodeId, RemoteAddress remoteAddress, Duration timeout) { clientTransport.registerEndpoint(nodeId, remoteAddress.getAddress()); return sendSyncRequest(nodeId, timeout); }
@Override public boolean sendMessage(Integer nodeId, BufferWriter writer) { final RemoteAddress remoteAddress = endpointRegistry.getEndpoint(nodeId); if (remoteAddress != null) { return sendTransportMessage(remoteAddress.getStreamId(), writer); } else { return false; } }
private void registerEndpoint( final ClientTransport transport, final int nodeId, final SocketAddress socketAddress) { final RemoteAddress endpoint = transport.getEndpoint(nodeId); if (endpoint == null || !socketAddress.equals(endpoint.getAddress())) { transport.registerEndpoint(nodeId, socketAddress); } }
/** * This stream is deactivated until it is registered again; the stream id in this case will remain * stable * * @param remote */ @Override public synchronized void deactivate(RemoteAddress remote) { getByStreamId(remote.getStreamId()).deactivate(); }
private boolean sendNotLeaderResponse( final ServerOutput output, final RemoteAddress remoteAddress, final long requestId) { response .reset() .requestId(requestId) .remoteStreamId(remoteAddress.getStreamId()) .writer(notLeaderResponse); return output.sendResponse(response); }