在做一个springmvc+netty的项目,要求当请求进到方法正常返回一个成功的同时另一条线程处理后台的业务,后台业务在处理的同时其实这个会话已经正常返回了。
@RequestMapping(value = "/static/o_index.do",method={RequestMethod.POST,RequestMethod.GET})
public void indexSubmit(HttpServletRequest request,
HttpServletResponse response, ModelMap model,String channelId,String _site_id_param) throws JSONException {
JSONObject jsonobj = new JSONObject();
jsonobj.append("messageID", request.getParameter("messageID"));
jsonobj.append("serviceID",request.getParameter("serviceID"));
jsonobj.append("respStatus", "1");
jsonobj.append("bizCode","");
jsonobj.append("bizDesc","首页静态化");
ResponseUtils.renderJson(response, jsonobj.toString());
runnableStatic.start();
以上是我的代码。runnableStatic是一个继承了thread的controller,(没有外面去调用它)返回成功后启动线程, 但是我觉得不对, 因为创建线程之前就已经返回了。 如果想做到返回response之后 另一条线程咋以后台工作我该怎么做。
跪谢!!!