code: public void destroy() {
      if (dead) return;
      dead = true;
  
      List<MortarScope> snapshot = new ArrayList<>(children.values());
      for (MortarScope child : snapshot) {
        child.destroy();
      }
  
      for (Scoped s : tearDowns) {
        s.onExitScope();
      }
      tearDowns.clear();
  
      Set<String> keys = services.keySet();
      for (String key : keys) {
        services.put(key, "Dead service");
      }
      if (parent != null) {
        parent.children.remove(getName());
      }
    }
docs: Sends {@link Scoped#onExitScope()} to all registrants. Parent scope drops its reference to
  this instance. Prior to this, recursively destroys all children. Redundant calls to this method
  are safe.