Created
September 9, 2011 13:34
-
-
Save nschlimm/1206220 to your computer and use it in GitHub Desktop.
HTMLDocumentGenerator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HTMLDocumentGenerator implements DocumentGenerator, Initialisierbar, Reinitialisierbar, HTMLDocumentGeneratorMBean { | |
private final ConcurrentHashMap<String, ConcurrentTransformer> transformerCache = | |
new ConcurrentHashMap<String, ConcurrentTransformer>(); | |
private int concurrentParserThreadCount = 10; | |
protected Semaphore bouncer; | |
... | |
public void createDocument(OutputStream document, Map<String, ?> inputData) throws DocumentGeneratorAusnahme { | |
... | |
ConcurrentTransformer newTransformer; | |
ConcurrentTransformer transformer = | |
transformerCache.putIfAbsent(xslDocumentName, newTransformer = new ConcurrentTransformer(xslDocumentName)); | |
if (transformer == null) { | |
transformer = newTransformer; | |
} | |
template = transformer.generateTemplate(loadTimeApplication); | |
... | |
} | |
... | |
public void initialize() throws InitialisierungsAusnahme { | |
transformerCache.clear(); | |
if (concurrentParserThreadCount <= 0) { | |
concurrentParserThreadCount = 10; | |
} | |
bouncer = new Semaphore(concurrentParserThreadCount); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment