commit | 74d5a1c1724f968eeaa00afc0b25c0717cb32018 | [log] [tgz] |
---|---|---|
author | Matthias Sohn <matthias.sohn@sap.com> | Mon Dec 28 02:21:17 2020 +0100 |
committer | Matthias Sohn <matthias.sohn@sap.com> | Sun Jan 03 19:59:35 2021 -0500 |
tree | 58884262c1c66e5a187757382f51d700b9f55b04 | |
parent | d9143287b778deba259cdd9d7db0a6aaba558eb2 [diff] |
RepositoryCache: declare schedulerLock final This fixes errorprone error [SynchronizeOnNonFinalField]: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. Change-Id: I42fe5bde825151693e2da2d5b6cd6e1d34038dbc
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java index c1beb6f..41f291b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
@@ -202,7 +202,7 @@ private volatile long expireAfter; - private Object schedulerLock = new Lock(); + private final Object schedulerLock = new Lock(); private RepositoryCache() { cacheMap = new ConcurrentHashMap<>();