On 18/07/2024 12:27, Konstantin Kolinko wrote:
чт, 18 июл. 2024 г. в 11:42, <[email protected]>:
<snip/>
@@ -287,6 +312,28 @@ public final class Library { return initialize(); } + + public static boolean tryCleanUpLock(long cleanupGeneration) { + try { + boolean result = cleanUpLock.readLock().tryLock(0, TimeUnit.SECONDS); + if (result && generation.get() == cleanupGeneration) { + return true; + } + cleanUpLock.readLock().unlock(); + } catch (InterruptedException e) { + // Treated the same way as not getting the lock + } + return false; + }Mark, I think there is a bug with the "readLock().unlock()" call above. It should be called only when the "result" of preceding tryLock() is true. Calling unlock() when no lock is held results in an IllegalMonitorStateException. [1] I see that this code is present on the 9.0.x branch only (and not on the 10.1.x and main branches). [1] https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/concurrent/locks/ReentrantReadWriteLock.ReadLock.html
Thanks for the review. I've fixed this in 9.0.x. This will get picked up for Tomcat Native for 1.3.2 onwards.
Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
