diff --git a/src/main/java/org/apache/ibatis/cache/decorators/BlockingCache.java b/src/main/java/org/apache/ibatis/cache/decorators/BlockingCache.java index a3483e95b68..7c4b08b0364 100644 --- a/src/main/java/org/apache/ibatis/cache/decorators/BlockingCache.java +++ b/src/main/java/org/apache/ibatis/cache/decorators/BlockingCache.java @@ -1,5 +1,5 @@ /** - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,21 +15,23 @@ */ package org.apache.ibatis.cache.decorators; +import java.text.MessageFormat; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; import org.apache.ibatis.cache.Cache; import org.apache.ibatis.cache.CacheException; /** - * Simple blocking decorator + *
Simple blocking decorator * - * Simple and inefficient version of EhCache's BlockingCache decorator. + *
Simple and inefficient version of EhCache's BlockingCache decorator. * It sets a lock over a cache key when the element is not found in cache. * This way, other threads will wait until this element is filled instead of hitting the database. * + *
By its nature, this implementation can cause deadlock when used incorrecly. + * * @author Eduardo Macarron * */ @@ -37,7 +39,7 @@ public class BlockingCache implements Cache { private long timeout; private final Cache delegate; - private final ConcurrentHashMap