Skip to content

Commit

Permalink
optimizing shutdown and synchronisation (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 committed Dec 26, 2018
1 parent dee5ecd commit ccbc2b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/asciidoc/intellij/AsciiDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ private void initWithExtensions(List<String> extensions) {
md = calcMd(projectBasePath, Collections.EMPTY_LIST);
}
if (!md.equals(hash)) {
if (asciidoctor != null) {
asciidoctor.shutdown();
asciidoctor = null;
}
ClassLoader old = Thread.currentThread().getContextClassLoader();
ByteArrayOutputStream boasOut = new ByteArrayOutputStream();
ByteArrayOutputStream boasErr = new ByteArrayOutputStream();
Expand Down Expand Up @@ -188,7 +192,7 @@ private void notify(ByteArrayOutputStream boasOut, ByteArrayOutputStream boasErr

public String render(String text, List<String> extensions) {
LogHandler logHandler = new IntellijLogHandler(name);
synchronized (this) {
synchronized (AsciiDoc.class) {
initWithExtensions(extensions);
ClassLoader old = Thread.currentThread().getContextClassLoader();
ByteArrayOutputStream boasOut = new ByteArrayOutputStream();
Expand Down

0 comments on commit ccbc2b8

Please sign in to comment.