ContextStorage which keeps track of opened and closed Scopes, reporting caller
information if a Scope is closed incorrectly or not at all.
Calling StrictContextStorage#close() will check at the moment it's called whether
there are any scopes that have been opened but not closed yet. This could be called at the end of
a unit test to ensure the tested code cleaned up scopes correctly.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class | |
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private final ContextStorage | |
| private static final Logger | |
| private final StrictContextStorage. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Scope | |
| pack-priv static AssertionError | |
| public void | close()
Implements java. Ensures all scopes that have been created by this storage have been closed. |
| pack-priv static StrictContextStorage | create(ContextStorage delegate)
Returns a new |
| public Context |
| delegate | back to summary |
|---|---|
| private final ContextStorage delegate | |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| pendingScopes | back to summary |
|---|---|
| private final StrictContextStorage. | |
| StrictContextStorage | back to summary |
|---|---|
| private StrictContextStorage(ContextStorage delegate) | |
| attach | back to summary |
|---|---|
| public Scope attach(Context context) Implements io. Doc from io. Sets the specified
| |
| callerError | back to summary |
|---|---|
| pack-priv static AssertionError callerError(StrictContextStorage. | |
| close | back to summary |
|---|---|
| public void close() Implements java. Ensures all scopes that have been created by this storage have been closed. This can be useful to call at the end of a test to make sure everything has been cleaned up. Note It is important to close all resources prior to calling this, so that in-flight operations are not mistaken as scope leaks. If this raises an error, consider if a Context#wrap(Executor) wrapped executor} is still running.
| |
| create | back to summary |
|---|---|
| pack-priv static StrictContextStorage create(ContextStorage delegate) Returns a new | |
| current | back to summary |
|---|---|
| public Context current() Implements io. Doc from io. Returns the current | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile boolean | |
| pack-priv final Context | |
| pack-priv final long | |
| pack-priv final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| closed | back to summary |
|---|---|
| pack-priv volatile boolean closed | |
| context | back to summary |
|---|---|
| pack-priv final Context context | |
| threadId | back to summary |
|---|---|
| pack-priv final long threadId | |
| threadName | back to summary |
|---|---|
| pack-priv final String threadName | |
| CallerStackTrace | back to summary |
|---|---|
| pack-priv CallerStackTrace(Context context) | |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentHashMap |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static StrictContextStorage. | |
| pack-priv List | |
| public void | run()
Overrides io. Implements java. Runs this operation. |
| map | back to summary |
|---|---|
| private final ConcurrentHashMap<AbstractWeakConcurrentMap. | |
| PendingScopes | back to summary |
|---|---|
pack-priv PendingScopes(ConcurrentHashMap<AbstractWeakConcurrentMap.
| |
| create | back to summary |
|---|---|
| pack-priv static StrictContextStorage. | |
| drainPendingCallers | back to summary |
|---|---|
| pack-priv List | |
| run | back to summary |
|---|---|
| public void run() Overrides io. Implements java. Doc from java. Runs this operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final StrictContextStorage. | |
| pack-priv final Scope |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements io. Closes this resource, relinquishing any underlying resources. |
| public String |
| caller | back to summary |
|---|---|
| pack-priv final StrictContextStorage. | |
| delegate | back to summary |
|---|---|
| pack-priv final Scope delegate | |
| StrictScope | back to summary |
|---|---|
| pack-priv StrictScope(Scope delegate, StrictContextStorage. | |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |