Skip to content

Commit

Permalink
sync refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Jun 26, 2012
1 parent fe72619 commit bf958dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;

import javax.tools.*;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -143,7 +137,9 @@ public abstract class AbstractAnnotationProcessorMojo extends AbstractMojo
private String[] excludes;


private ReentrantLock compileLock = new ReentrantLock();
private static final Lock syncExecutionLock = new ReentrantLock();



protected abstract File getSourceDirectory();
protected abstract File getOutputClassDirectory();
Expand Down Expand Up @@ -211,6 +207,8 @@ public void execute() throws MojoExecutionException
return;
}

syncExecutionLock.lock();

try
{
executeWithExceptionsHandled();
Expand All @@ -223,6 +221,9 @@ public void execute() throws MojoExecutionException
throw new MojoExecutionException("Error executing", e1);
}
}
finally {
syncExecutionLock.unlock();
}

}

Expand Down Expand Up @@ -333,7 +334,7 @@ public void report(Diagnostic< ? extends JavaFileObject> diagnostic)

}

compileLock.lock();
//compileLock.lock();
try {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

Expand Down Expand Up @@ -379,7 +380,7 @@ public void report(Diagnostic< ? extends JavaFileObject> diagnostic)
}
}
finally {
compileLock.unlock();
//compileLock.unlock();
}

}
Expand Down

0 comments on commit bf958dd

Please sign in to comment.