public void rebind(String name, Object obj, Attributes attrs) throws NamingException {
   ResolveResult res = getRootURLContext(name, myEnv);
   DirContext ctx = (DirContext) res.getResolvedObj();
   try {
     ctx.rebind(res.getRemainingName(), obj, attrs);
   } finally {
     ctx.close();
   }
 }
 public void rebind(Name name, Object obj, Attributes attrs) throws NamingException {
   if (name.size() == 1) {
     rebind(name.get(0), obj, attrs);
   } else {
     DirContext ctx = getContinuationDirContext(name);
     try {
       ctx.rebind(name.getSuffix(1), obj, attrs);
     } finally {
       ctx.close();
     }
   }
 }