Skip to content

Instantly share code, notes, and snippets.

@vegaasen
Created October 17, 2014 13:00
Show Gist options
  • Save vegaasen/d4eab723b494a1b7d239 to your computer and use it in GitHub Desktop.
Save vegaasen/d4eab723b494a1b7d239 to your computer and use it in GitHub Desktop.
@Test
public void misc() {
final SimpleDocumentBuilderHolder documentBuilderHolder = new SimpleDocumentBuilderHolder();
ExecutorService exec = Executors.newFixedThreadPool(10);
for (int i = 0; i < ROUNDS; i++) {
exec.submit(new Runnable() {
public void run() {
try {
final DocumentBuilder builder = documentBuilderHolder.allocateDocumentBuilder();
// synchronized (builder) {
try {
System.out.print("hehe");
builder.parse(samlWheelOfFortune());
} catch (final Throwable t) {
throw new AssertionHandlerException("Error parsing assertion", t);
} finally {
documentBuilderHolder.releaseDocumentBuilder(builder);
}
// }
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
exec.shutdown();
while (!executor.isTerminated()) {
//waiting for termination to complete
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment