Skip to content

Commit 9f22040

Browse files
committed
IGNITE-26608 Updates Scope JavaDoc.
1 parent 857d113 commit 9f22040

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

  • modules/commons/src/main/java/org/apache/ignite/internal/thread/context

modules/commons/src/main/java/org/apache/ignite/internal/thread/context/Scope.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,22 @@
1818
package org.apache.ignite.internal.thread.context;
1919

2020
/**
21-
* Represents an arbitrary Scope. A Scope is active from the moment it is created until the {@link #close()} method is
22-
* called on the {@link Scope} instance. It is strongly encouraged to use a try-with-resources block to close a Scope.
21+
* Represents the Scope of {@link OperationContext} attributes update. Explicitly calling {@link #close()} method undoes
22+
* the applied changes and restores previous attribute values, if any. Note that every Scope relating to a specific
23+
* {@link OperationContext} update must be closed to free up thread-bound resources and avoid memory leaks, so it is
24+
* highly encouraged to use a try-with-resource block with Scope instances.
25+
* <p>
26+
* Scope is result of the following {@link OperationContext} update operations:
27+
* <ul>
28+
* <li>{@link OperationContext#set(OperationContextAttribute, Object)} - creates a new or update an existing mapping
29+
* between specified {@link OperationContextAttribute} and its value</li>
30+
* <li>{@link OperationContext#restoreSnapshot(OperationContextSnapshot)} - updates {@link OperationContextAttribute}
31+
* values to match the values stored in {@link OperationContextSnapshot}</li>
32+
* </ul>
33+
* </p>
34+
*
35+
* @see OperationContext#set(OperationContextAttribute, Object)
36+
* @see OperationContext#restoreSnapshot(OperationContextSnapshot)
2337
*/
2438
public interface Scope extends AutoCloseable {
2539
/** Scope instance that does nothing when closed. */

0 commit comments

Comments
 (0)