/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Registers a virtualization context for {@link JasperPrint JasperPrint} object. * * @param context the virtualization context * @param print the print object */ public static void register(JRVirtualizationContext context, JasperPrint print) { synchronized (contexts) { contexts.put(print, context); } }
public synchronized Object put(Object key, Object value) { softReferenceCache.put( key, value ); return strongReferenceCache.put( key, value ); }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
/** * Reads the contents of this object from the given input stream. * * @param inp the input stream to read from * @throws IOException if the stream raises it * @throws ClassNotFoundException if the stream raises it */ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int)(table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); while (key != null) { Object value = inp.readObject(); put(key, value); key = inp.readObject(); } }
protected final void setLastObject(JRVirtualizable o) { if (lastObject != o) { if (o != null) { JRVirtualizationContext context = o.getContext(); Object ownerLast = lastObjectMap.get(context); if (ownerLast != o) { if (ownerLast != null) { lastObjectSet.remove(ownerLast); } lastObjectMap.put(context, o); lastObjectSet.put(o, Boolean.TRUE); } } this.lastObject = o; } }
protected String[] getExtensionBeanNames(Class extensionType) { synchronized (extensionBeanNamesCache) { String[] beanNames = (String[]) extensionBeanNamesCache.get(extensionType); if (beanNames == null) { beanNames = findExtensionBeanNames(extensionType); extensionBeanNamesCache.put(extensionType, beanNames); } return beanNames; } }
protected Map getContextInstanceCache() { Object contextKey = getContextKey(); Map contextCache = (Map) cache.get(contextKey); if (contextCache == null) { contextCache = new ReferenceMap(); cache.put(contextKey, contextCache); } return contextCache; }
protected static Map getHandlerBundles() { Object cacheKey = ExtensionsEnvironment.getExtensionsCacheKey(); Map handlerBundles; synchronized (handlersCache) { handlerBundles = (Map) handlersCache.get(cacheKey); if (handlerBundles == null) { handlerBundles = loadHandlerBundles(); handlersCache.put(cacheKey, handlerBundles); } } return handlerBundles; }
protected void setGrammarPoolProperty(SAXParser parser, String poolClassName) { try { Object cacheKey = getGrammerPoolCacheKey(); Object grammarPool; synchronized (GRAMMAR_POOL_CACHE) { grammarPool = GRAMMAR_POOL_CACHE.get(cacheKey); if (grammarPool == null) { if (log.isDebugEnabled()) { log.debug("Instantiating grammar pool of type " + poolClassName + " for cache key " + cacheKey); } grammarPool = ClassUtils.instantiateClass(poolClassName, Object.class); GRAMMAR_POOL_CACHE.put(cacheKey, grammarPool); } } parser.setProperty(XERCES_PARSER_PROPERTY_GRAMMAR_POOL, grammarPool); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Error setting Xerces grammar pool of type " + poolClassName, e); } } }
protected List getRegistries() { List registries; Object cacheKey = ExtensionsEnvironment.getExtensionsCacheKey(); synchronized (registryCache) { registries = (List) registryCache.get(cacheKey); if (registries == null) { registries = loadRegistries(); registryCache.put(cacheKey, registries); } } return registries; }
protected static Map getCachedComponentBundles() { Object cacheKey = ExtensionsEnvironment.getExtensionsCacheKey(); synchronized (cache) { Map components = (Map) cache.get(cacheKey); if (components == null) { components = findComponentBundles(); cache.put(cacheKey, components); } return components; } }
if (oldOut != null && oldOut != o) pagedOut.put(uid, oldOut); throw new IllegalStateException("Wrong object stored with UID \"" + o.getUID() + "\"");
public void virtualizeData(JRVirtualizable o) { String uid = o.getUID(); if (!isPagedOut(uid)) { o.beforeExternalization(); // virtualize try { pageOut(o); } catch (IOException e) { log.error("Error virtualizing object", e); throw new JRRuntimeException(e); } o.afterExternalization(); // Wait until we know it worked before tossing the data. o.removeVirtualData(); synchronized (this) { pagedOut.put(uid, o); } } }