Source:
@Override public void onMessage(GridNioSession ses, byte[] msg) { assert msg != null; ClientListenerConnectionContext connCtx = ses.meta(CONN_CTX_META_KEY); if (connCtx == null) { onHandshake(ses, msg); return; } ClientListenerMessageParser parser = connCtx.parser(); ClientListenerRequestHandler handler = connCtx.handler(); ClientListenerRequest req; try { req = parser.decode(msg); } catch (Exception e) { try { handler.unregisterRequest(parser.decodeRequestId(msg)); } catch (Exception e1) { U.error(log, "Failed to unregister request.", e1); } U.error(log, "Failed to parse client request.", e); ses.close(); return; } assert req != null; try { long startTime = 0; if (log.isDebugEnabled()) { startTime = System.nanoTime(); log.debug("Client request received [reqId=" + req.requestId() + ", addr=" + ses.remoteAddress() + ", req=" + req + ']'); } ClientListenerResponse resp; AuthorizationContext authCtx = connCtx.authorizationContext(); if (authCtx != null) AuthorizationContext.context(authCtx); try(IgniteSecuritySession s = ctx.security().startSession(connCtx.securityContext())) { resp = handler.handle(req); } finally { if (authCtx != null) AuthorizationContext.clear(); } if (resp != null) { if (log.isDebugEnabled()) { long dur = (System.nanoTime() - startTime) / 1000; log.debug("Client request processed [reqId=" + req.requestId() + ", dur(mcs)=" + dur + ", resp=" + resp.status() + ']'); } byte[] outMsg = parser.encode(resp); ses.send(outMsg); } } catch (Exception e) { handler.unregisterRequest(req.requestId()); U.error(log, "Failed to process client request [req=" + req + ']', e); ses.send(parser.encode(handler.handleException(e, req))); } }

Target:
@Override public void onMessage(GridNioSession ses, byte[] msg) { assert msg != null; ClientListenerConnectionContext connCtx = ses.meta(CONN_CTX_META_KEY); if (connCtx == null) { onHandshake(ses, msg); return; } ClientListenerMessageParser parser = connCtx.parser(); ClientListenerRequestHandler handler = connCtx.handler(); ClientListenerRequest req; try { req = parser.decode(msg); } catch (Exception e) { try { handler.unregisterRequest(parser.decodeRequestId(msg)); } catch (Exception e1) { U.error(log, "Failed to unregister request.", e1); } U.error(log, "Failed to parse client request.", e); ses.close(); return; } assert req != null; try { long startTime = 0; if (log.isDebugEnabled()) { startTime = System.nanoTime(); log.debug("Client request received [reqId=" + req.requestId() + ", addr=" + ses.remoteAddress() + ", req=" + req + ']'); } ClientListenerResponse resp; AuthorizationContext authCtx = connCtx.authorizationContext(); if (authCtx != null) AuthorizationContext.context(authCtx); try(OperationSecurityContext s = ctx.security().withContext(connCtx.securityContext())) { resp = handler.handle(req); } finally { if (authCtx != null) AuthorizationContext.clear(); } if (resp != null) { if (log.isDebugEnabled()) { long dur = (System.nanoTime() - startTime) / 1000; log.debug("Client request processed [reqId=" + req.requestId() + ", dur(mcs)=" + dur + ", resp=" + resp.status() + ']'); } byte[] outMsg = parser.encode(resp); ses.send(outMsg); } } catch (Exception e) { handler.unregisterRequest(req.requestId()); U.error(log, "Failed to process client request [req=" + req + ']', e); ses.send(parser.encode(handler.handleException(e, req))); } }