Skip to content

Commit 33abfaf

Browse files
committed
Addressed review comment:
- improved javadoc Signed-off-by: Ivan Malygin <[email protected]>
1 parent 7e0628f commit 33abfaf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

platform-sdk/swirlds-state-api/src/main/java/com/swirlds/state/StateLifecycleManager.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,22 @@ public interface StateLifecycleManager {
2727
* Get the mutable state. Consecutive calls to this method may return different instances,
2828
* if this method is not called on the one and the only thread that is calling {@link #copyMutableState}.
2929
* If a parallel thread calls {@link #copyMutableState}, the returned object will become immutable and
30-
* on the subsequent call of {@link #copyMutableState} it will be destroyed.
30+
* on the subsequent call of {@link #copyMutableState} it will be destroyed and, therefore, not usable in some contexts.
3131
*
3232
* @return the mutable state.
3333
*/
3434
MerkleNodeState getMutableState();
3535

3636
/**
37-
* Get the latest immutable state. Consecutive calls to this method may return different instances,
38-
* if this method is not called on the one and the only thread that is calling {@link #copyMutableState}
39-
* If a parallel thread calls {@link #copyMutableState}, the returned object will become destroyed.
37+
* Get the latest immutable state. Consecutive calls to this method may return different instances
38+
* if this method is not called on the one and only thread that is calling {@link #copyMutableState}.
39+
* If a parallel thread calls {@link #copyMutableState}, the returned object will become destroyed and, therefore, not usable in some contexts.
40+
* <br>
41+
* If a durable long-term reference to the immutable state returned by this method is required, it is the
42+
* responsibility of the caller to ensure a reference is maintained to prevent its garbage collection. Also,
43+
* it is the responsibility of the caller to ensure that the object is not used in contexts in which it may become unusable
44+
* (e.g., hashing of the destroyed state is not possible).
45+
*
4046
* @return the latest immutable state.
4147
*/
4248
MerkleNodeState getLatestImmutableState();

0 commit comments

Comments
 (0)