pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject [pdfbox-jbig2] branch master updated: PDFBOX-4472: avoid deadlock, as suggested by Arnaud Jeansen
Date Sat, 02 Mar 2019 12:16:37 GMT
This is an automated email from the ASF dual-hosted git repository.

tilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e27e5d  PDFBOX-4472: avoid deadlock, as suggested by Arnaud Jeansen
0e27e5d is described below

commit 0e27e5d714a0dba8bc503114e84482b3c335bcac
Author: Tilman Hausherr <tilman@snafu.de>
AuthorDate: Sat Mar 2 13:16:00 2019 +0100

    PDFBOX-4472: avoid deadlock, as suggested by Arnaud Jeansen
---
 .../java/org/apache/pdfbox/jbig2/util/cache/SoftReferenceCache.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/cache/SoftReferenceCache.java b/src/main/java/org/apache/pdfbox/jbig2/util/cache/SoftReferenceCache.java
index 9ad7027..497a9f1 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/util/cache/SoftReferenceCache.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/util/cache/SoftReferenceCache.java
@@ -18,13 +18,14 @@
 package org.apache.pdfbox.jbig2.util.cache;
 
 import java.lang.ref.SoftReference;
+import java.util.Collections;
 import java.util.Map;
 import java.util.WeakHashMap;
 
 public class SoftReferenceCache implements Cache
 {
-
-    private final Map<Object, SoftReference<?>> cache = new WeakHashMap<Object,
SoftReference<?>>();
+    private final Map<Object, SoftReference<?>> cache =
+            Collections.synchronizedMap(new WeakHashMap<Object, SoftReference<?>>());
 
     @Override
     public Object put(Object key, Object value, int sizeEstimate)


Mime
View raw message