Note
this implementation may keep up to one context in memory per thread. Child contexts for recursive uses are stored in the queue using a WEAK reference by default unless specified in the 2 argument constructor.
| Modifier and Type | Field and Description |
|---|---|
| private final ReentrantContextProviderCLQ | |
| private final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| public | ReentrantContextProviderTL(final int
reference type refType)Create a new ReentrantContext provider using the given reference type among hard, soft or weak. |
| public | ReentrantContextProviderTL(final int
reference type used by ThreadLocal refTypeTL, final int reference type used by ReentrantContextProviderCLQ refTypeCLQ)Create a new ReentrantContext provider using the given reference types among hard, soft or weak |
| Modifier and Type | Method and Description |
|---|---|
| public final K | Returns: ReentrantContext instanceImplements abstract com. Give a ReentrantContext instance for the current thread |
| public final void | release(final K
ReentrantContext instance ctx)Implements abstract com. Restore the given ReentrantContext instance for reuse |
| ctxProviderCLQ | back to summary |
|---|---|
| private final ReentrantContextProviderCLQ<K> ctxProviderCLQ | |
| ctxTL | back to summary |
|---|---|
| private final ThreadLocal<Reference<K>> ctxTL | |
| ReentrantContextProviderTL | back to summary |
|---|---|
| public ReentrantContextProviderTL(final int refType) Create a new ReentrantContext provider using the given reference type among hard, soft or weak. It uses weak reference for the child contexts.
| |
| ReentrantContextProviderTL | back to summary |
|---|---|
| public ReentrantContextProviderTL(final int refTypeTL, final int refTypeCLQ) Create a new ReentrantContext provider using the given reference types among hard, soft or weak
| |
| acquire | back to summary |
|---|---|
| public final K acquire() Implements abstract com. Give a ReentrantContext instance for the current thread
| |
| release | back to summary |
|---|---|
| public final void release(final K ctx) Implements abstract com. Restore the given ReentrantContext instance for reuse
| |