javax.naming.InitialContext#unbind ( )源码实例Demo

下面列出了javax.naming.InitialContext#unbind ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: micro-integrator   文件: DataSourceRepository.java
private void unregisterJNDI(DataSourceMetaInfo dsmInfo) {
		try {
//			PrivilegedCarbonContext.startTenantFlow();
//			PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(this.getTenantId());
			JNDIConfig jndiConfig = dsmInfo.getJndiConfig();
		    if (jndiConfig == null) {
			    return;
		    }
			try {
				InitialContext context = new InitialContext(jndiConfig.extractHashtableEnv());
				context.unbind(jndiConfig.getName());
		    } catch (NamingException e) {
			    log.error("Error in unregistering JNDI name: " +
		                jndiConfig.getName() + " - " + e.getMessage(), e);
		    }
		} finally {
//			PrivilegedCarbonContext.endTenantFlow();
		}
	}
 
源代码2 项目: lams   文件: JndiServiceImpl.java
@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 项目: development   文件: ConfigurationBeanTest.java
@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();
}
 
源代码4 项目: development   文件: RORControllerIT.java
@Test(expected = RuntimeException.class)
public void initializeNoJndi() throws Exception {
    InitialContext context = new InitialContext();
    context.unbind(APPlatformService.JNDI_NAME);
    // when no platform service is available via JNDI, the controller cannot
    // work
    new RORController().initialize();
}
 
源代码5 项目: development   文件: RORControllerIT.java
@Test(expected = RuntimeException.class)
public void initializeNoJndi_Communication() throws Exception {
    InitialContext context = new InitialContext();
    context.unbind(APPlatformService.JNDI_NAME);
    // when no platform service is available via JNDI, the controller cannot
    // work
    new ProcessManagerBean().initialize();
}
 
源代码6 项目: cacheonix-core   文件: MyRemoteServiceObject.java
public void stop() throws Exception
{
   if (m_running)
   {
      InitialContext ctx = new InitialContext();
      ctx.unbind(JNDI_NAME);
      UnicastRemoteObject.unexportObject(this, false);
      m_running = false;
      System.out.println("My remote service stopped successfully");
   }
}
 
源代码7 项目: apiman   文件: ManagerApiTestServer.java
/**
 * Stop the server.
 * @throws Exception
 */
public void stop() throws Exception {
    if (node != null) {
        deleteAndFlush();
        node.stop();
        System.out.println("================ STOPPED ES ================ ");
    }
    server.stop();
    if (ds != null) {
        ds.close();
        InitialContext ctx = TestUtil.initialContext();
        ctx.unbind("java:comp/env/jdbc/ApiManagerDS");
    }
}
 
源代码8 项目: pentaho-kettle   文件: DatabaseTest.java
@After
public void tearDown() throws NamingException {
  InitialContext ctx = new InitialContext();
  ctx.unbind( fullJndiName );
}
 
源代码9 项目: gmlc   文件: SS7Service.java
/**
 * Unbounds object under specified name.
 *
 * @param jndiName
 *            the JNDI name of the object to be unbound.
 */
private void unbind(String jndiName) throws NamingException {
    InitialContext initialContext = new InitialContext();
    initialContext.unbind(jndiName);
}