code: 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.");
  
  			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;
  	}
docs: Releases one reference to the given shared state in the registry. This decreases the
  reference count by one. Once the count reaches zero, the shared state is deleted.
  
  @param registrationKey the shared state for which we release a reference.
  @return the result of the request, consisting of the reference count after this operation
  and the state handle, or null if the state handle was deleted through this request. Returns null if the registry
  was previously closed.