Package org.mapfish.print.processor
Class AbstractProcessor.Context
- java.lang.Object
-
- org.mapfish.print.processor.AbstractProcessor.Context
-
- All Implemented Interfaces:
Processor.ExecutionContext
- Enclosing class:
- AbstractProcessor<IN,OUT>
public static final class AbstractProcessor.Context extends java.lang.Object implements Processor.ExecutionContext
Default implementation ofProcessor.ExecutionContext
.
-
-
Constructor Summary
Constructors Constructor Description Context(java.util.Map<java.lang.String,java.lang.String> mdcContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Sets the canceled flag.java.util.Map<java.lang.String,java.lang.String>
getMDCContext()
ExecutionStats
getStats()
<T> T
mdcContext(java.util.function.Supplier<T> action)
Set the MDC context while running the action.<T> T
mdcContextEx(java.util.concurrent.Callable<T> action)
Set the MDC context while running the action.void
stopIfCanceled()
Throws a CancellationException if the job was canceled.
-
-
-
Method Detail
-
cancel
public void cancel()
Sets the canceled flag.
-
stopIfCanceled
public void stopIfCanceled()
Description copied from interface:Processor.ExecutionContext
Throws a CancellationException if the job was canceled.- Specified by:
stopIfCanceled
in interfaceProcessor.ExecutionContext
-
getStats
public ExecutionStats getStats()
- Specified by:
getStats
in interfaceProcessor.ExecutionContext
- Returns:
- The ExecutionStats object
-
getMDCContext
public java.util.Map<java.lang.String,java.lang.String> getMDCContext()
- Specified by:
getMDCContext
in interfaceProcessor.ExecutionContext
- Returns:
- The MDC context for the current print job.
-
mdcContext
public <T> T mdcContext(java.util.function.Supplier<T> action)
Description copied from interface:Processor.ExecutionContext
Set the MDC context while running the action.- Specified by:
mdcContext
in interfaceProcessor.ExecutionContext
- Type Parameters:
T
- The returned class- Parameters:
action
- The action to run
-
mdcContextEx
public <T> T mdcContextEx(java.util.concurrent.Callable<T> action) throws java.lang.Exception
Description copied from interface:Processor.ExecutionContext
Set the MDC context while running the action.- Specified by:
mdcContextEx
in interfaceProcessor.ExecutionContext
- Type Parameters:
T
- The returned class- Parameters:
action
- The action to run- Throws:
java.lang.Exception
-
-