本文整理汇总了Java中javax.naming.InitialContext.unbind方法的典型用法代码示例。如果您正苦于以下问题:Java InitialContext.unbind方法的具体用法?Java InitialContext.unbind怎么用?Java InitialContext.unbind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.InitialContext
的用法示例。
在下文中一共展示了InitialContext.unbind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMissingBeanException
import javax.naming.InitialContext; //导入方法依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testMissingBeanException() throws Exception {
// Simulate missing EJB
InitialContext context = new InitialContext();
context.unbind(APPlatformService.JNDI_NAME);
// And invoke internal EJB constructor
new ConfigurationBean();
}
示例2: unbind
import javax.naming.InitialContext; //导入方法依赖的package包/类
@Override
public void unbind(String jndiName) {
final InitialContext initialContext = buildInitialContext();
final Name name = parseName( jndiName, initialContext );
try {
initialContext.unbind( name );
}
catch (Exception e) {
throw new JndiException( "Error performing unbind [" + name + "]", e );
}
finally {
cleanUp( initialContext );
}
}
示例3: unbind
import javax.naming.InitialContext; //导入方法依赖的package包/类
/**
* Removes the service instance for the specified service class from the naming directory
* @param serviceClass
* the service class interface that defines the {@link io.bdj.service.ServiceAddress}
*/
public static void unbind(Class<?> serviceClass) {
ServiceAddress addr = getServiceAddress(serviceClass);
try {
InitialContext ic = new InitialContext();
ic.unbind(addr.value());
} catch (NamingException e) {
throw new ServiceRuntimeException("Could not unbind service " + serviceClass.getName());
}
}