@CleanupObligation @ParametersAreNonnullByDefault public interface ExecutionContext extends AutoCloseable, JsonWriteable
Modifier and Type | Interface and Description |
---|---|
static class |
ExecutionContext.Relation |
static interface |
ExecutionContext.SimpleTag<T> |
static interface |
ExecutionContext.Tag<T,A> |
Modifier and Type | Method and Description |
---|---|
default <T> void |
accumulate(ExecutionContext.Tag<T,?> tag,
T data) |
default <T,A> void |
accumulateComponent(ExecutionContext.Tag<T,A> tag,
A data) |
void |
add(StackSamples samples) |
void |
add(StackTraceElement[] sample) |
void |
addCloseable(AutoCloseable closeable)
Attach a AutoCloseable to execution context.
|
void |
addLog(Slf4jLogRecord log) |
void |
addLogs(Collection<Slf4jLogRecord> log) |
default <T> List<T> |
addToRootParent(ExecutionContext.Tag<List<T>,T> tag,
T data) |
void |
attach()
Attach execution context to the current thread.
|
void |
close() |
default <T> void |
combine(ExecutionContext.Tag<T,?> tag,
T data)
Deprecated.
use accumulate.
|
<V,A> V |
compute(ExecutionContext.Tag<V,A> key,
BiFunction<ExecutionContext.Tag<V,A>,V,V> compute)
Compute context associated data.
|
void |
detach()
Detach this execution context from the current Thread.
|
default ExecutionContext |
detachedChild(String operationName) |
default ExecutionContext |
detachedChild(String operationName,
long timeout,
TimeUnit tu) |
<T> T |
get(ExecutionContext.Tag<T,?> key)
Method to get context associated data.
|
StackSamples |
getAndClearStackSamples() |
default Level |
getBackendMinLogLevel() |
Level |
getBackendMinLogLevel(String loggerName)
The minimum log level overwrite.
|
<T> ContextValue<T> |
getContextAndValue(ExecutionContext.Tag<T,?> key)
Method to get context associated data.
|
default Level |
getContextMinLogLevel() |
Level |
getContextMinLogLevel(String loggerName)
The minimum log level accepted by this execution context;
The logs that we will store in this context.
|
long |
getDeadlineNanos() |
default org.spf4j.base.avro.DebugDetail |
getDebugDetail(String origin,
Throwable throwable) |
default org.spf4j.base.avro.DebugDetail |
getDebugDetail(String origin,
Throwable throwable,
boolean addStackSamples) |
default org.spf4j.base.avro.DebugDetail |
getDebugDetail(String origin,
Throwable throwable,
boolean addStackSamples,
int maxNrLogs) |
CharSequence |
getId() |
<T> T |
getLocal(ExecutionContext.Tag<T,?> key)
Method to get context associated data.
|
default long |
getMillisToDeadline() |
String |
getName() |
default ExecutionContext |
getNotClosedParent() |
ExecutionContext.Relation |
getRelationToSource() |
default ExecutionContext |
getRoot() |
default ExecutionContext |
getRootParent() |
default int |
getSecondsToDeadline() |
ExecutionContext |
getSource() |
StackSamples |
getStackSamples() |
long |
getStartTimeNanos() |
default long |
getTimeRelativeToDeadline(TimeUnit unit) |
default long |
getTimeToDeadline(TimeUnit unit) |
default long |
getUncheckedTimeToDeadline(TimeUnit unit) |
boolean |
isAttached() |
boolean |
isClosed() |
long |
nextChildId() |
<T> T |
put(ExecutionContext.Tag<T,?> tag,
T data)
Method to put context associated data.
|
default <T> T |
putToRootParent(ExecutionContext.Tag<T,?> key,
T data)
Method to put context associated data to the root context.
|
default Level |
setBackendMinLogLevel(Level level) |
Level |
setBackendMinLogLevel(String loggerName,
Level level) |
default ExecutionContext |
startChild(String operationName) |
default ExecutionContext |
startChild(String operationName,
long timeout,
TimeUnit tu) |
void |
streamLogs(Consumer<Slf4jLogRecord> to) |
void |
streamLogs(Consumer<Slf4jLogRecord> to,
int nrLogs) |
writeJsonTo, writeJsonTo, writeTo
@DischargesObligation void close()
close
in interface AutoCloseable
CharSequence getId()
long getStartTimeNanos()
long getDeadlineNanos()
@Nullable ExecutionContext getSource()
default ExecutionContext getRoot()
default ExecutionContext getRootParent()
@Nullable default ExecutionContext getNotClosedParent()
@Beta void addLog(Slf4jLogRecord log)
@Beta void addLogs(Collection<Slf4jLogRecord> log)
@Beta void addCloseable(AutoCloseable closeable)
closeable
- @Beta Level getContextMinLogLevel(String loggerName)
default Level getContextMinLogLevel()
@Beta @Nullable Level getBackendMinLogLevel(String loggerName)
@Beta void streamLogs(Consumer<Slf4jLogRecord> to)
@Beta void streamLogs(Consumer<Slf4jLogRecord> to, int nrLogs)
void detach()
void attach()
boolean isAttached()
@Nonnegative default long getTimeToDeadline(TimeUnit unit) throws TimeoutException
TimeoutException
@Nonnegative default long getUncheckedTimeToDeadline(TimeUnit unit)
@Nonnegative default long getMillisToDeadline() throws TimeoutException
TimeoutException
@Nonnegative default int getSecondsToDeadline() throws TimeoutException
TimeoutException
@Nullable @Beta <T> T get(ExecutionContext.Tag<T,?> key)
T
- type of data.key
- key of data.@Nullable @Beta <T> ContextValue<T> getContextAndValue(ExecutionContext.Tag<T,?> key)
T
- type of data.key
- key of data.@Nullable @Beta <T> T getLocal(ExecutionContext.Tag<T,?> key)
T
- type of data.key
- key of data.@Nullable @Beta <T> T put(ExecutionContext.Tag<T,?> tag, T data)
T
- type of data.key
- the key of data.data
- the data.@Deprecated default <T> void combine(ExecutionContext.Tag<T,?> tag, T data)
@Beta default <T> void accumulate(ExecutionContext.Tag<T,?> tag, T data)
@Beta default <T,A> void accumulateComponent(ExecutionContext.Tag<T,A> tag, A data)
@Nullable @Beta default <T> T putToRootParent(ExecutionContext.Tag<T,?> key, T data)
T
- type of data.key
- the key of data.data
- the data.@Beta @Nullable <V,A> V compute(ExecutionContext.Tag<V,A> key, BiFunction<ExecutionContext.Tag<V,A>,V,V> compute)
K
- V
- key
- compute
- @Nullable @Beta default <T> List<T> addToRootParent(ExecutionContext.Tag<List<T>,T> tag, T data)
default ExecutionContext startChild(String operationName, long timeout, TimeUnit tu)
default ExecutionContext startChild(String operationName)
default ExecutionContext detachedChild(String operationName, long timeout, TimeUnit tu)
default ExecutionContext detachedChild(String operationName)
long nextChildId()
void add(StackTraceElement[] sample)
void add(StackSamples samples)
@Nullable StackSamples getAndClearStackSamples()
@Nullable StackSamples getStackSamples()
boolean isClosed()
ExecutionContext.Relation getRelationToSource()
default org.spf4j.base.avro.DebugDetail getDebugDetail(String origin, @Nullable Throwable throwable)
default org.spf4j.base.avro.DebugDetail getDebugDetail(String origin, @Nullable Throwable throwable, boolean addStackSamples)
Copyright © 2021 SPF4J. All rights reserved.