Skip to content

Commit

Permalink
Synchronizing on a public object, for true thread-safety (issue #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
ladwlo committed Sep 22, 2020
1 parent ddfda87 commit bb54417
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ public abstract class MojoSupport
*/
protected MavenProject project;

private static final Object lock = new Object();

/**
* Main Mojo execution hook. Sub-class should use {@link #doExecute} instead.
*/
public synchronized void execute() throws MojoExecutionException, MojoFailureException {
public void execute() throws MojoExecutionException, MojoFailureException {
try {
doExecute();
synchronized(lock) {
doExecute();
}
}
catch (Exception e) {
//
Expand Down

0 comments on commit bb54417

Please sign in to comment.