public void doHTTP(final Request req, final MinaSender sender) { exec.execute( () -> { Response resp = new Response(req.getNow()); try { Method proc = httpClass.getMethod(req.getMethod(), Object.class); Object data = proc.invoke(getHTTPTarget(), req.getParams()); resp.setData(data); } catch (Exception ex) { resp.putError(ex); Logger.getLogger(MinaLogicTarget.class.getName()).log(Level.SEVERE, null, ex); } finally { EntityPool.inst().releaseAllThreadResources(); sender.send(resp); } }); }
public void doAMF(final Request req, final MinaSender sender) { exec.execute( () -> { Response resp = new Response(req.getNow()); try { Method m = amfClass.getMethod(req.getMethod(), String.class, Map.class, long.class); Object data = m.invoke(getAMFTarget(), req.getCaller(), req.getParams(), req.getNow()); resp.setData(data); } catch (Exception ex) { resp.putError(ex); } finally { // Release thread res EntityPool.inst().releaseAllThreadResources(); // Resp null if invoke fail sender.send(resp); } }); }