@Override public Object invoke(final InvocationRequest invocation) throws Throwable { // Called for every client connecting to the server (after add Listener) String sessionId = invocation.getSessionId(); Map map = invocation.getRequestPayload(); String host; if (map != null) { InetAddress clientAddress = (InetAddress) invocation.getRequestPayload().get(Remoting.CLIENT_ADDRESS); host = clientAddress.getHostAddress(); } else { host = "localhost"; } Optional<Session> session = SessionManager.instance.getSession(sessionId); if (!session.isPresent()) { logger.error("Session not found : " + sessionId); } else { session.get().setHost(host); } return null; }
/** * Returns an id that can be used to identify this particular callback handler, which should be * representative of the client invoker it will make callbacks to. Currently, this is the * session id associated with the invocation request. */ public static String getId(InvocationRequest invocation) { String sessionId = invocation.getSessionId(); Map metadata = invocation.getRequestPayload(); if(metadata != null) { String listenerId = (String) metadata.get(Client.LISTENER_ID_KEY); if(listenerId != null) { sessionId = sessionId + "+" + listenerId; } } return sessionId; }
conn.setRequestProperty("sessionId", request.getSessionId()); conn.connect();
response = new InvocationResponse(request.getSessionId(), result, false, request.getReturnPayload()); response = new InvocationResponse(request.getSessionId(), throwable, true, request.getReturnPayload()); new InvocationResponse(request.getSessionId(), e, true, request.getReturnPayload());
private void updateClientLease(InvocationRequest invocation) { if(invocation != null) { String clientSessionId = invocation.getSessionId(); if(clientSessionId != null) { if(trace) { log.trace("Getting lease for client session id: " + clientSessionId); } Lease clientLease = (Lease)clientLeases.get(clientSessionId); if(clientLease == null) { Lease newClientLease = new Lease(clientSessionId, leasePeriod, locator.getLocatorURI(), invocation.getRequestPayload(), connectionNotifier, clientLeases); clientLeases.put(clientSessionId, newClientLease); newClientLease.startLease(); if(trace) { log.trace("No lease established for client session id (" + clientSessionId + "), so starting a new one."); } } else { // including request payload from invocation as may contain updated list of clients. clientLease.updateLease(leasePeriod, invocation.getRequestPayload()); if(trace) { log.trace("Updated lease for client session id (" + clientSessionId + ")"); } } } } }
String clientSessionId = invocation.getSessionId(); Lease clientLease = (Lease)clientLeases.get(clientSessionId);
private void init(InvocationRequest invocation, ServerInvoker owner) throws Exception clientSessionId = invocation.getSessionId(); sessionId = invocation.getSessionId();
responseMap.put(CLIENT_LEASE_PERIOD, new Long(leasePeriod)); InvocationResponse ir = new InvocationResponse(invocation.getSessionId(), new Boolean(leaseManagement), false, responseMap); String clientId = invocation.getSessionId();
resp = new InvocationResponse(req.getSessionId(), resp, isError, req.getReturnPayload());
responseObject = new InvocationResponse(invocationRequest.getSessionId(), responseObject, isError, responseMap);
Object args [] = nbi.getParameters(); String signature [] = nbi.getSignature(); String sessionId = invocation.getSessionId(); storeNotifications(invocation.getSessionId(), invocation.getReturnPayload());
String sessionId = invocationReq.getSessionId(); returnValue = transport(sessionId, payload, metadata, marshaller, unmarshaller);
responseObject = new InvocationResponse(invocationRequest.getSessionId(), responseObject, isError, responseMap);