/** * Returns the virtualization context registered for a print object. * <p> * When the engine fills a report using a virtualizer, it {@link #register(JRVirtualizationContext, JasperPrint) registers} * the virtualization context with the generated {@link JasperPrint JasperPrint} object so that the caller * would be able to retrieve the context based on the returned print object. * * @param print a print object * @return the virtualization context registered for the print object, or <code>null</code> if no context * has been registered */ public static JRVirtualizationContext getRegistered(JasperPrint print) { synchronized (contexts) { return (JRVirtualizationContext) contexts.get(print); } } }
public synchronized Object get(Object key) { Object result = softReferenceCache.get( key ); if ( result != null ) { strongReferenceCache.put( key, result ); } return result; }
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 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; } }
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 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; } }