removed volatile from one time initialized variables - Fixes
@@ -291,13 +291,13 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* File archiver moves segments from work directory to archive. Locked segments may be kept not moved until release.
* For mode archive and work folders set to equal value, archiver is not created.
*/
- @Nullable private volatile FileArchiver archiver;
+ @Nullable private FileArchiver archiver;
/** Compressor. */
- private volatile FileCompressor compressor;
+ private FileCompressor compressor;
/** Decompressor. */
- private volatile FileDecompressor decompressor;
+ private FileDecompressor decompressor;
/** */
private final ThreadLocal<WALPointer> lastWALPtr = new ThreadLocal<>();
@@ -306,10 +306,10 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private volatile FileWriteHandle currHnd;
/** File handle manager. */
- private volatile FileHandleManager fileHandleManager;
+ private FileHandleManager fileHandleManager;
/** */
- private volatile WALDisableContext walDisableContext;
+ private WALDisableContext walDisableContext;
/**
* Positive (non-0) value indicates WAL can be archived even if not complete<br>
@@ -347,7 +347,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private SegmentRouter segmentRouter;
/** Segment factory with ability locked segment during reading. */
- private volatile SegmentFileInputFactory lockedSegmentFileInputFactory;
+ private SegmentFileInputFactory lockedSegmentFileInputFactory;
/** FileHandleManagerFactory. */
private final FileHandleManagerFactory fileHandleManagerFactory;
@@ -407,6 +407,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
checkWalConfiguration();
+ synchronized (this) {
final File walWorkDir0 = walWorkDir = initDirectory(
dsCfg.getWalPath(),
DataStorageConfiguration.DFLT_WAL_PATH,
@@ -478,6 +479,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
ioFactory
);
}
+ }
/**
*
@@ -639,7 +641,9 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/*
walDisableContext is started after FileWriteAheadLogManager, so we obtain actual walDisableContext ref here.
*/
+ synchronized (this) {
walDisableContext = cctx.walState().walDisableContext();
+ }
assert currHnd == null;
assert lastPtr == null || lastPtr instanceof FileWALPointer;
