Skip to content

Commit 3bbef1e

Browse files
committed
rename
1 parent 174954f commit 3bbef1e

File tree

1 file changed

+5
-6
lines changed
  • x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common

1 file changed

+5
-6
lines changed

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFile.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,9 @@ protected void closeInternal() {
127127
private volatile FileChannelReference channelRef;
128128

129129
/**
130-
* Indicates if the file should be created when it is open for the first time.
131-
* This is required to pass the right options for sparse file support.
130+
* {@code true} if the physical cache file exists on disk
132131
*/
133-
private volatile boolean created;
132+
private volatile boolean fileExists;
134133

135134
public CacheFile(CacheKey cacheKey, long length, Path file, ModificationListener listener) {
136135
this(cacheKey, new SparseFileTracker(file.toString(), length), file, listener, false);
@@ -146,7 +145,7 @@ private CacheFile(CacheKey cacheKey, SparseFileTracker tracker, Path file, Modif
146145
this.file = Objects.requireNonNull(file);
147146
this.listener = Objects.requireNonNull(listener);
148147
assert fileExists == Files.exists(file) : file + " exists? " + fileExists;
149-
this.created = fileExists;
148+
this.fileExists = fileExists;
150149
assert invariant();
151150
}
152151

@@ -192,8 +191,8 @@ public void acquire(final EvictionListener listener) throws IOException {
192191
ensureOpen();
193192
if (listeners.isEmpty()) {
194193
assert channelRef == null;
195-
channelRef = new FileChannelReference(created ? OPEN_OPTIONS : CREATE_OPTIONS);
196-
created = true;
194+
channelRef = new FileChannelReference(fileExists ? OPEN_OPTIONS : CREATE_OPTIONS);
195+
fileExists = true;
197196
}
198197
final boolean added = listeners.add(listener);
199198
assert added : "listener already exists " + listener;

0 commit comments

Comments
 (0)