code: protected void checkRelease() {
          if (!isPersistent() && listeners.isEmpty() && !isAcquired()) {
              log.info("Deleting shared object {} because all clients disconnected and it is no longer acquired", name);
              if (storage != null) {
                  if (!storage.remove(this)) {
                      log.error("Could not remove shared object");
                  }
              }
              close();
          }
      }
docs: Check if shared object must be released.