Browse Source

[spotbugs] Don't use class from java.util.concurrent for locking

Use a dedicated Lock object to lock the scheduler in
RepositoryCache#configureEviction to fix spotbugs warning
JLM_JSR166_UTILCONCURRENT_MONITORENTER.

Change-Id: I003dcf0ed1a0a3f4eea5d8a2f51a07473d28a928
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v5.11.0.202102031030-m2
Matthias Sohn 3 years ago
parent
commit
13e0ffbd3d
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java View File

@@ -201,6 +201,8 @@ public class RepositoryCache {

private volatile long expireAfter;

private Object schedulerLock = new Lock();

private RepositoryCache() {
cacheMap = new ConcurrentHashMap<>();
openLocks = new Lock[4];
@@ -214,7 +216,7 @@ public class RepositoryCache {
RepositoryCacheConfig repositoryCacheConfig) {
expireAfter = repositoryCacheConfig.getExpireAfter();
ScheduledThreadPoolExecutor scheduler = WorkQueue.getExecutor();
synchronized (scheduler) {
synchronized (schedulerLock) {
if (cleanupTask != null) {
cleanupTask.cancel(false);
}

Loading…
Cancel
Save