code: private void rebind(Object stack) throws NamingException {
          if (jndiName != null) {
              Context ctx = new InitialContext();
              String[] tokens = jndiName.split("/");
  
              for (int i = 0; i < tokens.length - 1; i++) {
                  if (tokens[i].trim().length() > 0) {
                      try {
                          ctx = (Context) ctx.lookup(tokens[i]);
                      } catch (NamingException e) {
                          ctx = ctx.createSubcontext(tokens[i]);
                      }
                  }
              }
  
              ctx.bind(tokens[tokens.length - 1], stack);
          }
      }
docs: Binds trunk object to the JNDI under the jndiName.