/** * Return a shallow copy of this <code>FastHashMap</code> instance. * The keys and values themselves are not copied. */ public Object clone() { return new FastHashMap(map); }
public static Object getInstance(String uid) { log.debug("lookup: uid=" + uid); Object result = INSTANCES.get(uid); if (result==null) { log.warn("Not found: " + uid); log.debug(INSTANCES); } return result; }
public void objectRemoved(NamingEvent evt) { String name = evt.getOldBinding().getName(); log.info("A factory was unbound from name: " + name); Object instance = NAMED_INSTANCES.remove(name); Iterator iter = INSTANCES.values().iterator(); while ( iter.hasNext() ) { if ( iter.next()==instance ) iter.remove(); } } public void objectRenamed(NamingEvent evt) {
public static void removeInstance(String uid, String name, Properties properties) { //TODO: theoretically non-threadsafe... if (name!=null) { log.info("Unbinding factory from JNDI name: " + name); try { Context ctx = NamingHelper.getInitialContext(properties); ctx.unbind(name); log.info("Unbound factory from JNDI name: " + name); } catch (InvalidNameException ine) { log.error("Invalid JNDI name: " + name, ine); } catch (NamingException ne) { log.warn("Could not unbind factory from JNDI", ne); } NAMED_INSTANCES.remove(name); } INSTANCES.remove(uid); }
public static void addInstance(String uid, String name, SessionFactory instance, Properties properties) { log.debug("registered: " + uid + " (" + ( (name==null) ? "unnamed" : name ) + ')'); INSTANCES.put(uid, instance); if (name!=null) NAMED_INSTANCES.put(name, instance); //must add to JNDI _after_ adding to HashMaps, because some JNDI servers use serialization if (name==null) { log.info("Not binding factory to JNDI, no JNDI name configured"); } else { log.info("Factory name: " + name); try { Context ctx = NamingHelper.getInitialContext(properties); NamingHelper.bind(ctx, name, instance); log.info("Bound factory to JNDI name: " + name); ( (EventContext) ctx ).addNamingListener(name, EventContext.OBJECT_SCOPE, LISTENER); } catch (InvalidNameException ine) { log.error("Invalid JNDI name: " + name, ine); } catch (NamingException ne) { log.warn("Could not bind factory to JNDI", ne); } catch(ClassCastException cce) { log.warn("InitialContext did not implement EventContext"); } } }
public void objectRemoved(NamingEvent evt) { String name = evt.getOldBinding().getName(); log.info("A factory was unbound from name: " + name); Object instance = NAMED_INSTANCES.remove(name); Iterator iter = INSTANCES.values().iterator(); while ( iter.hasNext() ) { if ( iter.next()==instance ) iter.remove(); } } public void objectRenamed(NamingEvent evt) {
public static void removeInstance(String uid, String name, Properties properties) { //TODO: theoretically non-threadsafe... if (name!=null) { log.info("Unbinding factory from JNDI name: " + name); try { Context ctx = NamingHelper.getInitialContext(properties); ctx.unbind(name); log.info("Unbound factory from JNDI name: " + name); } catch (InvalidNameException ine) { log.error("Invalid JNDI name: " + name, ine); } catch (NamingException ne) { log.warn("Could not unbind factory from JNDI", ne); } NAMED_INSTANCES.remove(name); } INSTANCES.remove(uid); }
public static void addInstance(String uid, String name, SessionFactory instance, Properties properties) { log.debug("registered: " + uid + " (" + ( (name==null) ? "unnamed" : name ) + ')'); INSTANCES.put(uid, instance); if (name!=null) NAMED_INSTANCES.put(name, instance); //must add to JNDI _after_ adding to HashMaps, because some JNDI servers use serialization if (name==null) { log.info("Not binding factory to JNDI, no JNDI name configured"); } else { log.info("Factory name: " + name); try { Context ctx = NamingHelper.getInitialContext(properties); NamingHelper.bind(ctx, name, instance); log.info("Bound factory to JNDI name: " + name); ( (EventContext) ctx ).addNamingListener(name, EventContext.OBJECT_SCOPE, LISTENER); } catch (InvalidNameException ine) { log.error("Invalid JNDI name: " + name, ine); } catch (NamingException ne) { log.warn("Could not bind factory to JNDI", ne); } catch(ClassCastException cce) { log.warn("InitialContext did not implement EventContext"); } } }
public static Object getInstance(String uid) { log.debug("lookup: uid=" + uid); Object result = INSTANCES.get(uid); if (result==null) { log.warn("Not found: " + uid); log.debug(INSTANCES); } return result; }
/** * Return a shallow copy of this <code>FastHashMap</code> instance. * The keys and values themselves are not copied. */ public Object clone() { return new FastHashMap(map); }
public static Object getNamedInstance(String name) { log.debug("lookup: name=" + name); Object result = NAMED_INSTANCES.get(name); if (result==null) { log.warn("Not found: " + name); log.debug(NAMED_INSTANCES); } return result; }
public static Object getNamedInstance(String name) { log.debug("lookup: name=" + name); Object result = NAMED_INSTANCES.get(name); if (result==null) { log.warn("Not found: " + name); log.debug(NAMED_INSTANCES); } return result; }