public abstract class AbstractContextDecorator extends Object implements org.springframework.core.task.TaskDecorator
https://stackoverflow.com/questions/23732089/how-to-enable-request-scope-in-async-task-executor
传递:RequestAttributes and MDC and SecurityContext
| 限定符和类型 | 字段和说明 |
|---|---|
protected AsyncProperties |
asyncProperties |
| 构造器和说明 |
|---|
AbstractContextDecorator() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
completeServletAsyncContext(org.springframework.web.context.request.ServletRequestAttributes context,
AsyncProperties asyncProperties)
完成异步请求处理并关闭响应流
|
protected void |
enableServletAsyncContext(org.springframework.web.context.request.ServletRequestAttributes context,
AsyncProperties asyncProperties)
启用 ServletAsyncContext,异步上下文最长生命周期(最大阻塞父线程多久)
用于阻塞父线程 Servlet 的关闭(调用 destroy() 方法),导致子线程获取的上下文为空
|
protected AsyncProperties asyncProperties
protected void enableServletAsyncContext(org.springframework.web.context.request.ServletRequestAttributes context,
AsyncProperties asyncProperties)
用于阻塞父线程 Servlet 的关闭(调用 destroy() 方法),导致子线程获取的上下文为空
context - 父线程上下文asyncProperties - 异步属性配置protected void completeServletAsyncContext(org.springframework.web.context.request.ServletRequestAttributes context,
AsyncProperties asyncProperties)
context - 父线程上下文asyncProperties - 异步属性配置Copyright © 2021. All rights reserved.