Commits

chri...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed 468b8d5

CACHE-73. Switched over to using a Boolean for the barrierLock since it's serializable. Also allowed the logger to be recreated when deserializing

  • Participants
  • Parent commits 3f8cb1e

Comments (0)

Files changed (1)

File src/core/java/com/opensymphony/oscache/base/algorithm/AbstractConcurrentReadCache.java

 
     //OpenSymphony BEGIN (pretty long!)
     protected static final String NULL = "_nul!~";
-    protected static final transient Log log = LogFactory.getLog(AbstractConcurrentReadCache.class);
+    protected static transient Log log = LogFactory.getLog(AbstractConcurrentReadCache.class);
 
     /*
       The basic strategy is an optimistic-style scheme based on
     */
 
     /**
-     * Lock used only for its memory effects.
+     * Lock used only for its memory effects. We use a Boolean
+     * because it is serializable, and we create a new one because
+     * we need a unique object for each cache instance.
      **/
-    protected transient Object barrierLock = new Object();
+    protected final Boolean barrierLock = new Boolean(true);
 
     /**
      * field written to only to guarantee lock ordering.
         // Read in the threshold, loadfactor, and any hidden stuff
         s.defaultReadObject();
 
-        barrierLock = new Object();
+        log = LogFactory.getLog(AbstractConcurrentReadCache.class);
 
         // Read in number of buckets and allocate the bucket array;
         int numBuckets = s.readInt();