code: private void terminateSubscriptions(IoSession session, HeapState state, String heapUri, Subscription.CloseReason reason) {
          Lock heapUpdateLock = null;
          try {
              if (state != null) {
                  heapUpdateLock = state.getUpdateLock();
                  heapUpdateLock.lock();
              }
              subTermLock.lock();
  
              if (state != null) {
                  if (!state.isTerminated()) {
                      state.terminateSubscriptions(session, reason);
                      if (state.getSessions().isEmpty()) {
                          terminateSubscriptions(heapUri, reason);
                      }
                  }
              }
  
              Multiset<String> heapsForSession = heapsByClient.get(session);
              if (heapsForSession != null) {
                  nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, session, "Terminating subscription on %s heaps", heapsForSession.keySet().size());
                  heapsForSession.removeAll(heapUri);
                  if (heapsForSession.isEmpty()) {
                      terminateSubscriptions(session, reason);
                  }
              }
          } finally {
              subTermLock.unlock();
              if (heapUpdateLock != null) {
                  heapUpdateLock.unlock();
              }
          }
      }
docs: Terminates all subscriptions to a given heap from a single session