| Package | Description |
|---|---|
| cn.sliew.milky.thread | |
| cn.sliew.milky.thread.context |
| Modifier and Type | Method and Description |
|---|---|
ThreadContext.StoredContext |
ThreadContextMap.preserveContext()
preserve thread context map and set default context
|
ThreadContext.StoredContext |
ThreadContextStack.preserveContext()
preserve thread context map and set default context
|
ThreadContext.StoredContext |
ThreadContextStack.EmptyThreadContextStack.preserveContext() |
ThreadContext.StoredContext |
ThreadContext.preserveContext()
// current context is stored and replaced with a default context
try (StoredContext context = threadContext.preserveContext()) {
// execute();
}
// previous context is restored on StoredContext#close()
|
ThreadContext.StoredContext |
ThreadContextMap.storeContext()
preserve thread context map without default context
|
ThreadContext.StoredContext |
ThreadContextStack.storeContext()
preserve thread context map without default context
|
ThreadContext.StoredContext |
ThreadContextStack.EmptyThreadContextStack.storeContext() |
ThreadContext.StoredContext |
ThreadContext.storeContext() |
| Modifier and Type | Method and Description |
|---|---|
Supplier<ThreadContext.StoredContext> |
ThreadContext.newRestorableContext()
Supplier<ThreadContext.StoredContext> restorable = context.newRestorableContext();
new Thread() {
public void run() {
try (ThreadContext.StoredContext ctx = restorable.get()) {
// execute with the parents context and restore the threads context afterwards
}
}
}.start();
|
Supplier<ThreadContext.StoredContext> |
ThreadContext.wrapRestorable(ThreadContext.StoredContext storedContext) |
| Modifier and Type | Method and Description |
|---|---|
Supplier<ThreadContext.StoredContext> |
ThreadContext.wrapRestorable(ThreadContext.StoredContext storedContext) |
| Modifier and Type | Method and Description |
|---|---|
ThreadContext.StoredContext |
MutableThreadContextStack.preserveContext() |
ThreadContext.StoredContext |
DefaultThreadContextStack.preserveContext()
preserve context for later store then clear current thread context stack.
|
ThreadContext.StoredContext |
DefaultThreadContextMap.preserveContext() |
ThreadContext.StoredContext |
MutableThreadContextStack.storeContext() |
ThreadContext.StoredContext |
DefaultThreadContextStack.storeContext() |
ThreadContext.StoredContext |
DefaultThreadContextMap.storeContext() |
Copyright © 2022. All rights reserved.