void (final long startOffsetInFile, final int length) { do {//CAS loop: final long actualFileSize = actualSize.get(); final long requiredFileSize = startOffsetInFile + length; if (actualFileSize >= requiredFileSize) { return; } if (actualSize.compareAndSet(actualFileSize, requiredFileSize)) { return; } } while (true); }