@Override
  public Context createSubcontext(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(parsedName.get(0));
    if (parsedName.size() == 1) {
      // Check if name is already in use
      if (boundObject == null) {
        Context subContext = new ContextImpl(this, subContextName);
        ctxMaps.put(subContextName, subContext);
        return subContext;
      } else {
        throw new NameAlreadyBoundException(
            String.format("Name %s is already bound!", subContextName));
      }
    } else {
      if (boundObject instanceof Context) {
        // Let the subcontext create new subcontext
        // lets consider a scenerio a/b/c
        // case a/b exists : c will be created
        // case a exists : b/c will not be created
        // an exception will be thrown in that case.
        return ((Context) boundObject).createSubcontext(parsedName.getSuffix(1));
      } else {
        throw new NotContextException(String.format("Expected Context but found %s",
            boundObject));
      }
    }
  }
Creates subcontext with name, relative to this Context.

@param name subcontext name.
@return new subcontext named name relative to this context.
@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 NameAlreadyBoundException if name is already bound in this Context
@throws NotContextException if any intermediate name from name is not bound to instance of
        javax.naming.Context.
geode-core/src/main/java/org/apache/geode/internal/jndi/ContextImpl.java