Class MdcCopyingAsyncTaskExecutor
java.lang.Object
com.netflix.spinnaker.kork.web.context.MdcCopyingAsyncTaskExecutor
- All Implemented Interfaces:
Executor,org.springframework.core.task.AsyncTaskExecutor,org.springframework.core.task.TaskExecutor
public class MdcCopyingAsyncTaskExecutor
extends Object
implements org.springframework.core.task.AsyncTaskExecutor
Copy the MDC before executing tasks. This supports async controller methods (e.g. that return
StreamingResponseBody) passing X-SPINNAKER-* headers to downstream requests, and including the
MDC from the calling thread in log messages.
The typical pattern is:
AuthenticatedRequestFilter: copies X-SPINNAKER-* incoming request headers into the MDC SpinnakerRequestInterceptor: copies X-SPINNAKER-* from the MDC into outgoing request headers
MdcCopyingAsyncTaskExecutor makes it so SpinnakerRequestInterceptor has something to copy for async methods. It also makes it so log messages include X-SPINNAKER-*, specifically X-SPINNAKER-REQUEST-ID and X-SPINNAKER-REQUEST-ID to faciliate troubleshooting.
-
Field Summary
Fields inherited from interface org.springframework.core.task.AsyncTaskExecutor
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE -
Constructor Summary
ConstructorsConstructorDescriptionMdcCopyingAsyncTaskExecutor(org.springframework.core.task.AsyncTaskExecutor asyncTaskExecutor) -
Method Summary
-
Constructor Details
-
MdcCopyingAsyncTaskExecutor
public MdcCopyingAsyncTaskExecutor(org.springframework.core.task.AsyncTaskExecutor asyncTaskExecutor)
-
-
Method Details
-
execute
-
execute
- Specified by:
executein interfaceorg.springframework.core.task.AsyncTaskExecutor
-
submit
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor
-
submit
- Specified by:
submitin interfaceorg.springframework.core.task.AsyncTaskExecutor
-