Class ClientRequestContext.ContextScope
java.lang.Object
com.loomcache.client.context.ClientRequestContext.ContextScope
- Enclosing class:
ClientRequestContext
Fluent builder for constructing scoped context with specific values.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> @Nullable TExecute a supplier within this scoped context and return its result.Set the map name for this scope.operationName(@Nullable String value) Set the operation name for this scope.Set the request ID for this scope.voidExecute a runnable within this scoped context.startTimestamp(@Nullable Long value) Set the start timestamp for this scope.
-
Constructor Details
-
ContextScope
public ContextScope()
-
-
Method Details
-
requestId
Set the request ID for this scope.- Parameters:
value- the request ID (may be null)- Returns:
- this scope for chaining
-
operationName
Set the operation name for this scope.- Parameters:
value- the operation name (may be null)- Returns:
- this scope for chaining
-
mapName
Set the map name for this scope.- Parameters:
value- the map name (may be null)- Returns:
- this scope for chaining
-
startTimestamp
Set the start timestamp for this scope.- Parameters:
value- the start timestamp in nanoseconds (may be null)- Returns:
- this scope for chaining
-
run
Execute a runnable within this scoped context. Context values are set before execution and cleaned up afterward.- Parameters:
runnable- the code to execute with context bound
-
call
Execute a supplier within this scoped context and return its result. Context values are set before execution and cleaned up afterward.- Parameters:
supplier- the code to execute with context bound- Returns:
- the result of the supplier
-