@Override
  public void destroySubcontext(Name name) throws NamingException {
    checkIsDestroyed();
    Name parsedName = getParsedName(name);
    if (parsedName.size() == 0 || parsedName.get(0).length() == 0) {
      throw new InvalidNameException(
          "Name can not be empty!");
    }
    String subContextName = parsedName.get(0);
    Object boundObject = ctxMaps.get(subContextName);
    if (boundObject == null) {
      throw new NameNotFoundException(String.format("Name %s not found in the context!",
          subContextName));
    }
    if (!(boundObject instanceof ContextImpl)) {
      throw new NotContextException();
    }
    ContextImpl contextToDestroy = (ContextImpl) boundObject;
    if (parsedName.size() == 1) {
      // Check if the Context to be destroyed is empty. Can not destroy
      // non-empty Context.
      if (contextToDestroy.ctxMaps.size() == 0) {
        ctxMaps.remove(subContextName);
        contextToDestroy.destroyInternal();
      } else {
        throw new ContextNotEmptyException(
            "Can not destroy non-empty Context!");
      }
    } else {
      // Let the subcontext destroy the context
      ((ContextImpl) boundObject).destroySubcontext(parsedName.getSuffix(1));
    }
  }
Destroys subcontext with name name. The subcontext must be empty otherwise
ContextNotEmptyException is thrown. Once a context is destroyed, the instance should not be
used.

@param name subcontext to destroy
@throws NoPermissionException if this context has been destroyed.
@throws InvalidNameException if name is empty or is CompositeName that spans more than one
        naming system.
@throws ContextNotEmptyException if Context name is not empty.
@throws NameNotFoundException if subcontext with name name can not be found.
@throws NotContextException if name is not bound to instance of ContextImpl.
geode-core/src/main/java/org/apache/geode/internal/jndi/ContextImpl.java