/** * @jmx:managed-operation * */ public void addMetaData(Object key, Object value) { metadata.put(key, value); }
/** * Add a class to the the cache */ void cacheLoadedClass(String name, Class cls, ClassLoader cl) { synchronized( classes ) { // Update the global cache classes.put(name, cls); if( log.isTraceEnabled() ) { log.trace("cacheLoadedClass, classname: "+name+", class: "+cls +", cl: "+cl); } /** * TODO: Adding this implementation is a hack for jmx 1.2 checkin. * Had to add this because need getCachedClass() to work. * However, this method does not add loaded classes to collection * to be unloaded when called to remove classloader. * Hopefully this will be a short term workaround. * Contact telrod@e2technologies.net if you have questions. -TME */ } }
/** Add a Class to the repository cache. * @param name the fully qualified class name * @param cls the Class instance * @param cl the repository UCL */ public void cacheLoadedClass(String name, Class cls, ClassLoader cl) { synchronized (classes) { // Update the global cache Object prevClass = classes.put(name, cls); if (log.isTraceEnabled()) { log.trace("cacheLoadedClass, classname: " + name + ", class: " + cls + ", ucl: " + cl + ", prevClass: " + prevClass); } // Update the cache for this classloader // This is used to cycling classloaders HashSet loadedClasses = (HashSet) loaderToClassesMap.get(cl); if (loadedClasses == null) { loadedClasses = new HashSet(); loaderToClassesMap.put(cl, loadedClasses); } loadedClasses.add(name); } }
protected void passivate(EnterpriseContext ctx) throws RemoteException { m_container.getPersistenceManager().passivateSession((StatefulSessionEnterpriseContext) ctx); passivatedIDs.put(ctx.getId(), new Long(System.currentTimeMillis())); }
((WebClassLoader) cl).getKey() : getClassLoaderKey(cl); loaderMap.put(key, cl); URL loaderURL = null; String codebase = System.getProperty("java.rmi.server.codebase");
/** * Returns the bit number for the given name. If the name does not exist * a new new bit number for that name is created. * * @param name the name to lookup * @return the bit number for the given name */ private int getBitNumber(Name name) { Integer i = (Integer) nameIndex.get(name); if (i == null) { synchronized (nameIndex) { i = (Integer) nameIndex.get(name); if (i == null) { int idx = nameIndex.size(); i = new Integer(idx); nameIndex.put(name, i); if (idx >= names.length) { Name[] newNames = new Name[names.length * 2]; System.arraycopy(names, 0, newNames, 0, names.length); names = newNames; } names[idx] = name; } } } return i.intValue(); }
/** * Returns the bit number for the given name. If the name does not exist * a new new bit number for that name is created. * * @param name the name to lookup * @return the bit number for the given name */ private int getBitNumber(Name name) { Integer i = (Integer) nameIndex.get(name); if (i == null) { synchronized (nameIndex) { i = (Integer) nameIndex.get(name); if (i == null) { int idx = nameIndex.size(); i = new Integer(idx); nameIndex.put(name, i); if (idx >= names.length) { Name[] newNames = new Name[names.length * 2]; System.arraycopy(names, 0, newNames, 0, names.length); names = newNames; } names[idx] = name; } } } return i.intValue(); }
/** * Provides the same functionality as {@link java.net.URLClassLoader#getResource}. */ public URL getResourceLocally(String name) { URL resURL = (URL) resourceCache.get(name); if (resURL != null) return resURL; if (isResourceBlackListed(name)) return null; resURL = super.getResource(name); if( log.isTraceEnabled() == true ) log.trace("getResourceLocally("+this+"), name="+name+", resURL:"+resURL); if (resURL == null) addToResourceBlackList(name); else resourceCache.put(name, resURL); return resURL; }
public long getNextSequence(Object key) throws SequenceGeneratorException { Sequence seq = (Sequence) map.get(key); if (seq != null) return seq.next(); synchronized (map) { if (!map.containsKey(key)) { if (listener != null) listener.sequenceCreatedFor(key); map.put(key, (seq = new SimpleSequence())); } else { seq = (Sequence) map.get(key); } } return seq.next(); }