From bf7921455e8e44d7751655d051ddbc3e0d07e9fd Mon Sep 17 00:00:00 2001 From: Jendrik Johannes Date: Mon, 28 Aug 2017 12:07:51 +0200 Subject: [PATCH] Restore check if initialization is still required Fixes #2737 --- .../FixedSharedModeCrossProcessCacheAccess.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/subprojects/persistent-cache/src/main/java/org/gradle/cache/internal/FixedSharedModeCrossProcessCacheAccess.java b/subprojects/persistent-cache/src/main/java/org/gradle/cache/internal/FixedSharedModeCrossProcessCacheAccess.java index 5e1ba364469e..c8f517b2c6c2 100644 --- a/subprojects/persistent-cache/src/main/java/org/gradle/cache/internal/FixedSharedModeCrossProcessCacheAccess.java +++ b/subprojects/persistent-cache/src/main/java/org/gradle/cache/internal/FixedSharedModeCrossProcessCacheAccess.java @@ -78,11 +78,14 @@ public void open() { try { if (exclusiveLock != null) { final FileLock acquiredExclusiveLock = exclusiveLock; - exclusiveLock.writeFile(new Runnable() { - public void run() { - initializationAction.initialize(acquiredExclusiveLock); - } - }); + rebuild = initializationAction.requiresInitialization(acquiredExclusiveLock); + if (rebuild) { + exclusiveLock.writeFile(new Runnable() { + public void run() { + initializationAction.initialize(acquiredExclusiveLock); + } + }); + } } } finally { if (exclusiveLock != null) {