Package org.cyclos.impl
Class RequestContext
- java.lang.Object
-
- org.cyclos.impl.RequestContext
-
public class RequestContext extends Object
The context attached to the current thread and created for a specific new request to Cyclos made to any of its available entry points.
Please have a look at theServiceFacadeinterface for the list of entry points.
It differs from theInvocationContextin the sense it transcends the transaction used to invoke the requested operation.
The most common case is when the operation throws aRetryException, for that case, all the invocation chain fromServiceInvokerHandleronwards is restarted and the InvocationContext is cleaned and removed from the current thread but this context remains. It is removed ONLY when the request was finished (because was processed successfully, an error other thanRetryExceptionhas occurred or the max retries was reached).- See Also:
ServiceFacade
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E extends ProfilingEvent>
EaddProfilingEvent(Function<StartProfilingParams,E> supplier)Adds a profiling event if profiling is enabled for the currentRequestContextstatic voidaddSensitiveQueryParamValue(Object value)Adds a sensitive query parameter value to the current context.static RequestContextensure()Returns the current context instance or create a new one if missing.static RequestContextget()ProfilingEntrygetProfilingEntry()StartProfilingParamsgetProfilingParams()booleanisSensitiveQueryParamValue(Object value)voidregisterFile(File file)Register a new file created when processing the request.static voidremove()Removes the current contextvoidsetProfiling(Pair<StartProfilingParams,ProfilingEntry> profiling)
-
-
-
Method Detail
-
addProfilingEvent
public static <E extends ProfilingEvent> E addProfilingEvent(Function<StartProfilingParams,E> supplier)
Adds a profiling event if profiling is enabled for the currentRequestContext
-
addSensitiveQueryParamValue
public static void addSensitiveQueryParamValue(Object value)
Adds a sensitive query parameter value to the current context. When profiling is active, any value marked as sensitive will be masked in the resulting profiling data.
-
ensure
public static RequestContext ensure()
Returns the current context instance or create a new one if missing.
-
get
public static RequestContext get()
-
remove
public static void remove()
Removes the current context
-
getProfilingEntry
public ProfilingEntry getProfilingEntry()
-
getProfilingParams
public StartProfilingParams getProfilingParams()
-
isSensitiveQueryParamValue
public boolean isSensitiveQueryParamValue(Object value)
-
registerFile
public void registerFile(File file)
Register a new file created when processing the request. All registered files are removed when the context is removed.
-
setProfiling
public void setProfiling(Pair<StartProfilingParams,ProfilingEntry> profiling)
-
-