rkhachatryan commented on a change in pull request #17774:
URL: https://github.com/apache/flink/pull/17774#discussion_r766733767



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/state/SharedStateRegistry.java
##########
@@ -135,126 +58,77 @@ public Result registerReference(
      *     the state handle, or null if the state handle was deleted through 
this request. Returns
      *     null if the registry was previously closed.
      */
-    public Result unregisterReference(SharedStateRegistryKey registrationKey) {
-
-        Preconditions.checkNotNull(registrationKey);
-
-        final Result result;
-        final StreamStateHandle scheduledStateDeletion;
-        SharedStateRegistry.SharedStateEntry entry;
-
-        synchronized (registeredStates) {
-            entry = registeredStates.get(registrationKey);
-
-            Preconditions.checkState(
-                    entry != null,
-                    "Cannot unregister a state that is not registered: %s",
-                    registrationKey);
-
-            entry.decreaseReferenceCount();
-
-            // Remove the state from the registry when it's not referenced any 
more.
-            if (entry.getReferenceCount() <= 0) {
-                registeredStates.remove(registrationKey);
-                scheduledStateDeletion = entry.getStateHandle();
-                result = new Result(null, 0);
-            } else {
-                scheduledStateDeletion = null;
-                result = new Result(entry);
-            }
-        }
-
-        LOG.trace("Unregistered shared state {} under key {}.", entry, 
registrationKey);
-        scheduleAsyncDelete(scheduledStateDeletion);
-        return result;
-    }
+    SharedStateRegistry.Result unregisterReference(SharedStateRegistryKey 
registrationKey);
 
     /**
      * Register given shared states in the registry.
      *
      * @param stateHandles The shared states to register.
      */
-    public void registerAll(Iterable<? extends CompositeStateHandle> 
stateHandles) {
+    void registerAll(Iterable<? extends CompositeStateHandle> stateHandles);
 
-        if (stateHandles == null) {
-            return;
-        }
+    /** The result of an attempt to (un)/reference state */
+    class Result {

Review comment:
       I didn't re-order them; I removed `Result` and moved `SharedStateEntry` 
to `SharedStateRegistryImpl` once it wasn't needed in the interface.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to