code: private void terminateSubscriptions(String heapUri, Subscription.CloseReason reason) {
          HeapState state = heapStates.get(heapUri);
          if (state != null) {
              try {
                  state.getUpdateLock().lock();
                  subTermLock.lock();
                  // if someone got here first, don't bother doing the work
                  if (!state.isTerminated()) {
                      heapStates.remove(heapUri);
                      heapUris.remove(state.getHeapId());
                      List<IoSession> sessions = state.getSessions();
                      for (IoSession session : sessions) {
                          terminateSubscriptions(session, state, heapUri, reason);
                      }
                      LOGGER.error("Terminating heap state '{}'", heapUri);
                      state.terminate();
                      state.removeListener();
                  }
              } finally {
                  subTermLock.unlock();
                  state.getUpdateLock().unlock();
              }
          }
      }
docs: Terminates all subscriptions for a given heap