public void close() { try { managedDataSource.close(); new InitialContext().unbind(uniqueName); } catch (Exception e) { throw new RuntimeException(e); } }
private void unbind(String name) { InitialContext rootCtx = null; try { rootCtx = new InitialContext(); rootCtx.unbind(name); NonSerializableFactory.unbind(name); } catch (NamingException e) { log.warn("Failed to unbind scheduler with jndiName: " + name, e); } finally { if (rootCtx != null) { try { rootCtx.close(); } catch (NamingException ignore) {} } } } }
private void unbind(String name) { InitialContext rootCtx = null; try { rootCtx = new InitialContext(); rootCtx.unbind(name); NonSerializableFactory.unbind(name); } catch (NamingException e) { log.warn("Failed to unbind scheduler with jndiName: " + name, e); } finally { if (rootCtx != null) { try { rootCtx.close(); } catch (NamingException ignore) {} } } } }
@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 ); } }
/** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { userTransaction.begin(); // Delete by query. String deleteQuery = "Delete from CouchDBPersonJTAEntity p"; Query query = em.createQuery(deleteQuery); query.executeUpdate(); deleteQuery = "Delete from CouchDBAddressJTAEntity p"; query = em.createQuery(deleteQuery); query.executeUpdate(); userTransaction.commit(); initialContext.unbind("java:comp/UserTransaction"); initialContext.destroySubcontext("java:comp"); super.dropDatabase(); } }
@Override public void unbind(String name) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.unbind(name); } else { this.initialContext.unbind(name); } }
@Override public void unbind(Name name) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.unbind(name); } else { this.initialContext.unbind(name); } }
@Override public void unbind(String name) throws Exception { InitialContext context = new InitialContext(); if (name.startsWith(OSGI_JNDI_CONTEXT_PREFIX)) { throw new IllegalArgumentException("You can't unbind a name from the " + OSGI_JNDI_CONTEXT_PREFIX + " JNDI context."); } context.unbind(name); }
private void unbind() throws NamingException { new InitialContext().unbind(JNDI_NAME); NonSerializableFactory.unbind(JNDI_NAME); }
/** * Unbind the transaction manager from the provided JNDI context. * @param initialContext * @throws javax.naming.NamingException */ public static void unbindJTATransactionManagerImplementation(InitialContext initialContext) throws javax.naming.NamingException { initialContext.unbind(getTransactionManagerJNDIName()); }
/** * Unbind the transaction manager from the provided JNDI context. * @param initialContext * @throws javax.naming.NamingException */ public static void unbindJTATransactionManagerImplementation(InitialContext initialContext) throws javax.naming.NamingException { initialContext.unbind(getTransactionManagerJNDIName()); }
/** * Unbind the TSR from the provided JNDI context. * @param initialContext * @throws javax.naming.NamingException */ public static void unbindJTATransactionSynchronizationRegistryImplementation(InitialContext initialContext) throws javax.naming.NamingException { initialContext.unbind(getTransactionSynchronizationRegistryJNDIName()); }
private void unbindTransaction() { try { InitialContext ic = new InitialContext(env); ic.unbind("tl/tx"); } catch (NamingException e) { throw new KernelRuntimeException(e); } }
public void close() { try { managedDataSource.close(); new InitialContext().unbind(uniqueName); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Unbind the TSR from the provided JNDI context. * @param initialContext * @throws javax.naming.NamingException */ public static void unbindJTATransactionSynchronizationRegistryImplementation(InitialContext initialContext) throws javax.naming.NamingException { initialContext.unbind(getTransactionSynchronizationRegistryJNDIName()); }
public void unRegister(String name) { InitialContext context = getCachedInitialContext(name); try { context.unbind(name); } catch (NamingException e) { throw new SynapseCommonsException("Error removing a Datasource with name : " + name + " from the JNDI context : " + initialContext, e); } cachedNameList.remove(name); }
private void unbindAll() throws Exception { Collection<List<String>> bindings = allBindings.values(); for (List<String> binding : bindings) { for (String s : binding) { getInitialContext().unbind(s); } } }
/** * Unbinds the repository from the JNDI context. */ private void unregisterJNDI() { if (jndiContext != null) { try { jndiContext.unbind(config.getJndiConfig().getJndiName()); } catch (NamingException e) { log("Error while unbinding repository from JNDI: " + e); } } }
@AfterClass public void destroyDatasourceAndUnbind() throws NamingException { InitialContext ic = new InitialContext(); ic.unbind(getDatasourceLocation()); assert ic.lookup(getDatasourceLocation()) == null; ds.stop(); }
@Test public void testRebind_2() throws Exception { try { ic.lookup("/doesnotexistyet"); ProxyAssertSupport.fail("the name is not supposed to be there"); } catch (NameNotFoundException e) { // OK } JNDIUtil.rebind(ic, "/doesnotexistyet", new Integer(8)); ProxyAssertSupport.assertEquals(8, ((Integer) ic.lookup("/doesnotexistyet")).intValue()); ic.unbind("doesnotexistyet"); }