javax.naming.Context.unbind()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中javax.naming.Context.unbind()方法的一些代码示例,展示了Context.unbind()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.unbind()方法的具体详情如下:
包路径:javax.naming.Context
类名称:Context
方法名:unbind

Context.unbind介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
  protected Object doOperation(HttpServerExchange exchange, String name) throws NamingException {
    localContext.unbind(name);
    return null;
  }
}

代码示例来源:origin: apache/shiro

public Object doInContext(Context ctx) throws NamingException {
    ctx.unbind(name);
    return null;
  }
});

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(String name) throws NamingException {
  context.unbind(name);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(Name name) throws NamingException {
  context.unbind(name);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Remove the binding for the given name from the current JNDI context.
 * @param name the JNDI name of the object
 * @throws NamingException thrown by JNDI, mostly name not found
 */
public void unbind(final String name) throws NamingException {
  if (logger.isDebugEnabled()) {
    logger.debug("Unbinding JNDI object with name [" + name + "]");
  }
  execute(ctx -> {
    ctx.unbind(name);
    return null;
  });
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Remove the binding for the given name from the current JNDI context.
 * @param name the JNDI name of the object
 * @throws NamingException thrown by JNDI, mostly name not found
 */
public void unbind(final String name) throws NamingException {
  if (logger.isDebugEnabled()) {
    logger.debug("Unbinding JNDI object with name [" + name + "]");
  }
  execute(ctx -> {
    ctx.unbind(name);
    return null;
  });
}

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(final Name name) throws NamingException {
  CNCtxFactory.INSTANCE.getInitialContext(environment).unbind(name);
}

代码示例来源:origin: apache/geode

public static void unMapDatasource(String jndiName) throws NamingException {
 ctx.unbind("java:/" + jndiName);
 Object removedDataSource = dataSourceMap.remove(jndiName);
 closeDataSource(removedDataSource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(final String name) throws NamingException {
  CNCtxFactory.INSTANCE.getInitialContext(environment).unbind(name);
}

代码示例来源:origin: internetarchive/heritrix3

public static CompoundName unbindObjectName(final Context context,
    final ObjectName on)
throws NullPointerException, NamingException {
  CompoundName key = getCompoundName(on);
  context.unbind(key);
  return key;
}

代码示例来源:origin: apache/geode

private static void cleanup() {
 if (transactionManager instanceof TransactionManagerImpl) {
  TransactionManagerImpl.refresh();
  // unbind and set TransactionManager to null, so as to
  // initialize TXManager correctly if the cache is being restarted
  transactionManager = null;
  try {
   if (ctx != null) {
    ctx.unbind("java:/TransactionManager");
   }
  } catch (NamingException e) {
   // ok to ignore, rebind will be tried later
  }
 }
 dataSourceMap.values().stream().forEach(JNDIInvoker::closeDataSource);
 dataSourceMap.clear();
 IGNORE_JTA = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "ignoreJTA");
}

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(final Name name) throws NamingException {
  Assert.checkNotNullParam("name", name);
  final ReparsedName reparsedName = reparse(name);
  ContextResult result = getProviderContext(reparsedName.getUrlScheme());
  if(result.oldStyle) {
    result.context.unbind(name);
  } else {
    result.context.unbind(reparsedName.getName());
  }
}

代码示例来源:origin: wildfly/wildfly

public static void tearDownRecursively(final Context c) throws Exception {
 for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
   Binding b = ne.next();
   String name = b.getName();
   Object object = b.getObject();
   if (object instanceof Context) {
    JNDIUtil.tearDownRecursively((Context) object);
   }
   c.unbind(name);
 }
}

代码示例来源:origin: wildfly/wildfly

@Override
public void unbind(final String name) throws NamingException {
  Assert.checkNotNullParam("name", name);
  final ReparsedName reparsedName = reparse(getNameParser().parse(name));
  ContextResult result = getProviderContext(reparsedName.getUrlScheme());
  if(result.oldStyle) {
    result.context.unbind(name);
  } else {
    result.context.unbind(reparsedName.getName());
  }
}

代码示例来源:origin: wildfly/wildfly

public void unbind(Name name) throws NamingException {
  final ParsedName parsedName = parse(name);
  final Context namespaceContext = findContext(name, parsedName);
  if (namespaceContext == null)
    super.unbind(parsedName.remaining());
  else
    namespaceContext.unbind(parsedName.remaining());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void testUnbind() throws Exception {
  String name = "something";
  final Context context = mock(Context.class);
  JndiTemplate jt = new JndiTemplate() {
    @Override
    protected Context createInitialContext() {
      return context;
    }
  };
  jt.unbind(name);
  verify(context).unbind(name);
  verify(context).close();
}

代码示例来源:origin: spring-projects/spring-framework

assertTrue(ctx.lookup(name) == o);
ctx.unbind(name);
try {
  ctx = new InitialContext();

代码示例来源:origin: wildfly/wildfly

/**
 * Converts the "Name" name into a NameComponent[] object and
 * performs the unbind operation. Uses callUnbind. Throws an
 * invalid name exception if the name is empty.
 *
 * @param name string
 * @throws NamingException See callUnbind
 */
public void unbind(Name name)
    throws NamingException {
  if (name.size() == 0)
    throw IIOPLogger.ROOT_LOGGER.invalidEmptyName();
  NameComponent[] path = org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.nameToCosName(name);
  try {
    callUnbind(path);
  } catch (CannotProceedException e) {
    javax.naming.Context cctx = getContinuationContext(e);
    cctx.unbind(e.getRemainingName());
  }
}

代码示例来源:origin: spring-projects/spring-framework

context3.unbind("myobject");

代码示例来源:origin: apache/geode

/**
 * Removes all entries from the specified context, including subcontexts.
 *
 * @param context context to clear
 */
private void clearContext(Context context) throws NamingException {
 for (NamingEnumeration e = context.listBindings(""); e.hasMoreElements();) {
  Binding binding = (Binding) e.nextElement();
  if (binding.getObject() instanceof Context) {
   clearContext((Context) binding.getObject());
  }
  context.unbind(binding.getName());
 }
}

相关文章