void sendSessionMessages() { ClientSessionHandler handler = handlers.get(sessionRefId); /* * If a local handler exists, forward messages to local * handler to send to client session; otherwise log * error message. */ if (handler != null && handler.isConnected()) { if (sendLoginResult) { if (loginSuccess) { handler.loginSuccess(); } else { handler.loginFailure(loginException); return; } } SessionProtocol protocol = handler.getSessionProtocol(); if (protocol != null) { for (SendEvent sendEvent : messages) { try { protocol.sessionMessage(ByteBuffer.wrap(sendEvent.message), sendEvent.delivery); } catch (Exception e) { logger.logThrow(Level.WARNING, e, "sessionMessage throws"); } } } } else { logger.log(Level.FINE, "Discarding messages for disconnected session:{0}", handler); } }
/** {@inheritDoc} */ public SessionProtocol getSessionProtocol(BigInteger sessionRefId) { if (sessionRefId == null) { throw new NullPointerException("null sessionRefId"); } serviceStats.getSessionProtocolOp.report(); ClientSessionHandler handler = handlers.get(sessionRefId); return handler != null ? handler.getSessionProtocol() : null; }