@ThreadSafe @ParametersAreNonnullByDefault public class BasicExecutionContext extends Object implements ExecutionContext
ExecutionContext.Relation, ExecutionContext.Tag<T>| Constructor and Description |
|---|
BasicExecutionContext(String name,
CharSequence id,
ExecutionContext source,
ExecutionContext.Relation relation,
long startTimeNanos,
long deadlineNanos) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(StackSamples samples)
add a bunch of samples to this context.
|
void |
add(StackTraceElement[] sample)
Add a sample to this execution context.
|
void |
addCloseable(AutoCloseable closeable)
Attach a AutoCloseable to execution context.
|
void |
addLog(Slf4jLogRecord log) |
void |
addLogs(Collection<Slf4jLogRecord> pLogs) |
void |
attach() |
void |
close()
Close might be overridable to close any additional stuff added in the extended class.
|
<V> V |
compute(ExecutionContext.Tag<V> key,
BiFunction<ExecutionContext.Tag<V>,V,V> compute)
Compute context associated data.
|
void |
detach() |
<T> T |
get(ExecutionContext.Tag<T> key)
Method to get context associated data.
|
StackSamples |
getAndClearStackSamples()
get the collected stack samples.
|
Level |
getBackendMinLogLevel(String loggerName)
Overwrite for more configurable implementation.
|
Level |
getContextMinLogLevel(String loggerName)
Overwrite for more configurable implementation.
|
long |
getDeadlineNanos() |
CharSequence |
getId() |
String |
getName() |
ExecutionContext.Relation |
getRelationToSource() |
ExecutionContext |
getSource() |
StackSamples |
getStackSamples()
overwrite in a context that supports this functionality.
|
long |
getStartTimeNanos() |
boolean |
isClosed() |
long |
nextChildId() |
<T> T |
put(ExecutionContext.Tag<T> key,
T data)
Method to put context associated data.
|
Level |
setBackendMinLogLevel(String loggerName,
Level level)
Overwrite for more configurable implementation.
|
void |
streamLogs(Consumer<Slf4jLogRecord> to) |
String |
toString()
Overwrite as needed for debug string.
|
void |
writeJsonTo(Appendable appendable)
Overwrite this method to change default json format.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, addToRootParent, closeAll, closeAllButRoot, combine, detachedChild, detachedChild, getBackendMinLogLevel, getContextMinLogLevel, getDebugDetail, getMillisToDeadline, getNotClosedParent, getRoot, getRootParent, getSecondsToDeadline, getTimeRelativeToDeadline, getTimeToDeadline, getUncheckedTimeToDeadline, putToRootParent, setBackendMinLogLevel, startChild, startChildwriteJsonTo, writeTopublic BasicExecutionContext(String name, @Nullable CharSequence id, @Nullable ExecutionContext source, ExecutionContext.Relation relation, long startTimeNanos, long deadlineNanos)
public final String getName()
getName in interface ExecutionContextpublic final long getDeadlineNanos()
getDeadlineNanos in interface ExecutionContextpublic final long getStartTimeNanos()
getStartTimeNanos in interface ExecutionContext@Nullable @Beta public final <T> T put(@Nonnull ExecutionContext.Tag<T> key, @Nonnull T data)
ExecutionContextput in interface ExecutionContextT - type of data.data - the data.@Nullable @Beta public final <T> T get(@Nonnull ExecutionContext.Tag<T> key)
ExecutionContextget in interface ExecutionContextT - type of data.key - key of data.@Nullable public final <V> V compute(@Nonnull ExecutionContext.Tag<V> key, BiFunction<ExecutionContext.Tag<V>,V,V> compute)
ExecutionContextcompute in interface ExecutionContextpublic final ExecutionContext getSource()
getSource in interface ExecutionContextpublic void close()
close in interface AutoCloseableclose in interface ExecutionContextpublic final void detach()
detach in interface ExecutionContextpublic final void attach()
attach in interface ExecutionContextpublic String toString()
public void writeJsonTo(Appendable appendable) throws IOException
writeJsonTo in interface JsonWriteableappendable - IOExceptionpublic final void addLog(Slf4jLogRecord log)
addLog in interface ExecutionContext@Beta public final void addCloseable(AutoCloseable closeable)
ExecutionContextaddCloseable in interface ExecutionContextpublic final void addLogs(Collection<Slf4jLogRecord> pLogs)
addLogs in interface ExecutionContextpublic final void streamLogs(Consumer<Slf4jLogRecord> to)
streamLogs in interface ExecutionContextpublic Level getContextMinLogLevel(String loggerName)
getContextMinLogLevel in interface ExecutionContextloggerName - public Level getBackendMinLogLevel(String loggerName)
getBackendMinLogLevel in interface ExecutionContextloggerName - public Level setBackendMinLogLevel(String loggerName, Level level)
setBackendMinLogLevel in interface ExecutionContextloggerName - public final CharSequence getId()
getId in interface ExecutionContextpublic final long nextChildId()
nextChildId in interface ExecutionContextpublic void add(StackTraceElement[] sample)
add in interface ExecutionContextsample - @Nullable public StackSamples getAndClearStackSamples()
getAndClearStackSamples in interface ExecutionContext@Nullable public StackSamples getStackSamples()
getStackSamples in interface ExecutionContextpublic final boolean isClosed()
isClosed in interface ExecutionContextpublic final ExecutionContext.Relation getRelationToSource()
getRelationToSource in interface ExecutionContextpublic void add(StackSamples samples)
add in interface ExecutionContextsamples - Copyright © 2019 SPF4J. All rights reserved.