Make AllocatedPersistentTask members volatile (#2297)
These members are default initialized on contruction and then set by the init() method. It's possible that another thread accessing the object after init() is called could still see the null/0 values, depending on how the compiler optimizes the code.
This commit is contained in:
parent
b0de3c38d6
commit
7313ad5b29
|
@ -36,16 +36,16 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
* Represents a executor node operation that corresponds to a persistent task
|
||||
*/
|
||||
public class AllocatedPersistentTask extends CancellableTask {
|
||||
private String persistentTaskId;
|
||||
private long allocationId;
|
||||
private volatile String persistentTaskId;
|
||||
private volatile long allocationId;
|
||||
|
||||
private final AtomicReference<State> state;
|
||||
@Nullable
|
||||
private Exception failure;
|
||||
private volatile Exception failure;
|
||||
|
||||
private PersistentTasksService persistentTasksService;
|
||||
private Logger logger;
|
||||
private TaskManager taskManager;
|
||||
private volatile PersistentTasksService persistentTasksService;
|
||||
private volatile Logger logger;
|
||||
private volatile TaskManager taskManager;
|
||||
|
||||
|
||||
public AllocatedPersistentTask(long id, String type, String action, String description, TaskId parentTask) {
|
||||
|
|
Loading…
Reference in New Issue