1
我有一个Web服务方法,它应该处理一个非常大的文件并将多个文件输出到服务器。但是,这个Web服务只会超时,调用者无法获得CREATED状态。我只是想知道是否有办法运行处理作业(启动一个新的线程或其他东西)并返回状态而不用等待进程完成。使用Web服务处理大文件
public Response processFile(InputStream inputStream){
//I want to process the file here
//but I dont want the invoker to wait for that process to finish
//I just want the response to be returned right away
return Response.status(Response.Status.CREATED).build();
}
我很确定它会收到整个文件之前,即使得到方法的主体没有? – denniss 2011-05-26 21:28:46
@denniss不知道,这是你的代码。通过你的评论我会说是的。好的,你已经尝试过线程化了吗? – JHollanti 2011-05-26 21:35:29