Add missing synchronization and remove unnecessary volatile
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class DeferredLog implements Log {
|
||||
|
||||
private volatile Log destination;
|
||||
private Log destination;
|
||||
|
||||
private final Supplier<Log> destinationSupplier;
|
||||
|
||||
@@ -175,7 +175,9 @@ public class DeferredLog implements Log {
|
||||
}
|
||||
|
||||
void switchOver() {
|
||||
this.destination = this.destinationSupplier.get();
|
||||
synchronized (this.lines) {
|
||||
this.destination = this.destinationSupplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user