Use volatile to ensure concurrent threads use up to date property value

pull/122/head
luccioman 8 years ago
parent 28b451a0b3
commit 5fdd5d16b1

@ -60,19 +60,19 @@ public class Compressor implements BLOB, Iterable<byte[]> {
private TreeMap<byte[], byte[]> buffer; private TreeMap<byte[], byte[]> buffer;
/** Total size (in bytes) of uncompressed entries in buffer */ /** Total size (in bytes) of uncompressed entries in buffer */
private long bufferlength; private volatile long bufferlength;
/** Maximum {@link #bufferlength} value before compressing and flushing to the backend */ /** Maximum {@link #bufferlength} value before compressing and flushing to the backend */
private final long maxbufferlength; private final long maxbufferlength;
/** Maximum time (in milliseconds) to acquire a synchronization lock on get() and insert() */ /** Maximum time (in milliseconds) to acquire a synchronization lock on get() and insert() */
private long lockTimeout; private volatile long lockTimeout;
/** Synchronization lock */ /** Synchronization lock */
private final ReentrantLock lock; private final ReentrantLock lock;
/** The compression level */ /** The compression level */
private int compressionLevel; private volatile int compressionLevel;
/** /**
* @param backend the backend storage * @param backend the backend storage

Loading…
Cancel
Save