我有以下代码:
public void doSomething(HttpServletRequest requestContext){
new RequestProcessor(requestContext).process();
}
private class RequestProcessor implements Runnable {
public RequestProcessor(HttpServletRequest request)
{
this.request = request;
}
private void process() {
new Thread(this).start();
}
public void run() {
System.out.println(request.toString()) //ignore the logic here, is only a example...
}
}
但是当实例化请求处理器时,出现以下异常:
java.lang.IllegalStateException: No thread local value in scope for proxy of class com.sun.proxy.$Proxy
我需要将完整的HttpservletRequest发送到线程,是否存在执行此操作的方法?