mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-11-30 02:00:11 +08:00
Concurrency issues while handling log events in the daemon, fixes #16
This commit is contained in:
@@ -45,13 +45,13 @@ public abstract class AbstractLoggingSpy extends AbstractEventSpy {
|
||||
protected List<String> events;
|
||||
|
||||
@Override
|
||||
public void init(Context context) throws Exception {
|
||||
public synchronized void init(Context context) throws Exception {
|
||||
projects = new LinkedHashMap<>();
|
||||
events = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public synchronized void close() throws Exception {
|
||||
events = null;
|
||||
projects = null;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public abstract class AbstractLoggingSpy extends AbstractEventSpy {
|
||||
protected void update() {
|
||||
}
|
||||
|
||||
public void append(String projectId, String event) {
|
||||
public synchronized void append(String projectId, String event) {
|
||||
ProjectBuild project = projectId != null ? projects.get(projectId) : null;
|
||||
if (project != null) {
|
||||
project.events.add(event);
|
||||
|
||||
Reference in New Issue
Block a user