/** * Runs the given block in the context of a cache. * If you do not run your block this way, the caching * mechanism will be disabled. * * @param block block */ public static void runBlock(InternableBlock block) { String processId = getProcessId(); cachedBlocks.add(processId); block.run(); cachedBlocks.remove(processId); clearAll(processId); }
private void compile(final File bpelFile) { final BpelC bpelc = BpelC.newBpelCompiler(); // BPEL 1.1 does not suport the <import> element, so "global" WSDL needs to be configured explicitly. File bpel11wsdl = findBpel11Wsdl(bpelFile); if (bpel11wsdl != null) bpelc.setProcessWSDL(bpel11wsdl.toURI()); bpelc.setCompileProperties(prepareCompileProperties(bpelFile)); bpelc.setBaseDirectory(_duDirectory); // Create process such that immutable objects are intern'ed. InternPool.runBlock(new InternableBlock() { public void run() { try { bpelc.compile(bpelFile, getVersion()); } catch (IOException e) { __log.error("Compile error in " + bpelFile, e); } } }); }
/** * Returns an internalized value if it already exists in the cache * * @param value value * * @return the internalized value */ public static Object intern(Object key, Object value) { String processId = getProcessId(); if (!cachedBlocks.contains(processId)) { return value; } synchronized (cachedValues) { List values = (List) cachedValues.get(processId, key); if (values == null) { cachedValues.put(processId, key, (values = new ArrayList())); } Object intern; if (values.contains(value)) { intern = values.get(values.indexOf(value)); } else { values.add(intern = value); } return intern; } }
private void compile(final File bpelFile) { final BpelC bpelc = BpelC.newBpelCompiler(); // BPEL 1.1 does not suport the <import> element, so "global" WSDL needs to be configured explicitly. File bpel11wsdl = findBpel11Wsdl(bpelFile); if (bpel11wsdl != null) { bpelc.setProcessWSDL(bpel11wsdl.toURI()); } bpelc.setCompileProperties(prepareCompileProperties(bpelFile)); bpelc.setExtensionValidators(_extensionValidators); bpelc.setBaseDirectory(_duDirectory); // Create process such that immutable objects are intern'ed. InternPool.runBlock(new InternableBlock() { public void run() { try { bpelc.compile(bpelFile, getVersion()); } catch (IOException e) { __log.error("Compile error in " + bpelFile, e); } } }); }