use of com.z.gateway.protocol.OpenApiHttpReqTask in project gateway-dubbox by zhuzhong.
the class OpenApiAcceptHandlerImpl method addTask2Pool.
private void addTask2Pool(HttpServletResponse response, OpenApiHttpSessionBean sessionBean) {
long currentTime = System.currentTimeMillis();
if (logger.isDebugEnabled()) {
logger.debug(String.format("begin deal_sessionbean,current_time=%d,sessionbean=%s ", currentTime, sessionBean));
}
logger.info("added one task to thread pool");
OpenApiHttpReqTask task = null;
String operationType = sessionBean.getRequest().getOperationType();
OpenApiHandlerExecuteTemplate handlerExecuteTemplate = applicationContext.getBean(operationType, OpenApiHandlerExecuteTemplate.class);
task = new OpenApiHttpReqTask(sessionBean, handlerExecuteTemplate);
/**
* 走责任链,将相关的请求处理
*/
OpenApiHttpSessionBean tmp = (OpenApiHttpSessionBean) poolHandler.addTask(task);
// 写入响应
OpenApiResponseUtils.writeRsp(response, tmp.getRequest());
if (logger.isDebugEnabled()) {
logger.debug(String.format("end deal_sessionbean,current_time=%d,elapase_time=%d milseconds,sessionbean=%s", System.currentTimeMillis(), (System.currentTimeMillis() - currentTime), tmp));
}
}
Aggregations