public void processMessageReceived(Request request, TransportChannel channel) throws Exception { final Task task = taskManager.register(channel.getChannelType(), action, request); if (task == null) { handler.messageReceived(request, channel); } else { boolean success = false; try { handler.messageReceived( request, new TransportChannelWrapper(taskManager, task, channel), task); success = true; } finally { if (success == false) { taskManager.unregister(task); } } } }
private void endTask() { taskManager.unregister(task); }