Modifier and Type | Class and Description |
---|---|
static interface |
MdcUtils.MdcCloseable
AutoCloseable that restores the MDC contents on close. |
Constructor and Description |
---|
MdcUtils() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
asContextData(JobID jobID) |
static Executor |
scopeToJob(JobID jobID,
Executor executor)
|
static ExecutorService |
scopeToJob(JobID jobID,
ExecutorService delegate)
Wrap the given
ExecutorService so that the given JobID is added before it
executes any submitted commands and removed afterward. |
static ScheduledExecutorService |
scopeToJob(JobID jobID,
ScheduledExecutorService ses)
Wrap the given
ScheduledExecutorService so that the given JobID is added
before it executes any submitted commands and removed afterward. |
static MdcUtils.MdcCloseable |
withContext(Map<String,String> context)
Replace MDC contents with the provided one and return a closeable object that can be used to
restore the original MDC.
|
static <T> Callable<T> |
wrapCallable(Map<String,String> contextData,
Callable<T> command)
Wrap the given
Callable so that the given data is added to MDC before its
execution and removed afterward. |
static Runnable |
wrapRunnable(Map<String,String> contextData,
Runnable command)
Wrap the given
Runnable so that the given data is added to MDC before its
execution and removed afterward. |
public static final String JOB_ID
public static MdcUtils.MdcCloseable withContext(Map<String,String> context)
context
- to put into MDCpublic static Runnable wrapRunnable(Map<String,String> contextData, Runnable command)
Runnable
so that the given data is added to MDC
before its
execution and removed afterward.public static <T> Callable<T> wrapCallable(Map<String,String> contextData, Callable<T> command)
Callable
so that the given data is added to MDC
before its
execution and removed afterward.public static ExecutorService scopeToJob(JobID jobID, ExecutorService delegate)
ExecutorService
so that the given JobID
is added before it
executes any submitted commands and removed afterward.public static ScheduledExecutorService scopeToJob(JobID jobID, ScheduledExecutorService ses)
ScheduledExecutorService
so that the given JobID
is added
before it executes any submitted commands and removed afterward.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.