Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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

luccioman5fdd5d16b1ae
diff --git a/source/net/yacy/kelondro/blob/Compressor.java b/source/net/yacy/kelondro/blob/Compressor.java
index a78cb3cd1..3152e0f4e 100644
--- a/source/net/yacy/kelondro/blob/Compressor.java
+++ b/source/net/yacy/kelondro/blob/Compressor.java
@@ -60,19 +60,19 @@ public class Compressor implements BLOB, Iterable<byte[]> {
private TreeMap<byte[], byte[]> 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 */
private final long maxbufferlength;
/** Maximum time (in milliseconds) to acquire a synchronization lock on get() and insert() */
- private long lockTimeout;
+ private volatile long lockTimeout;
/** Synchronization lock */
private final ReentrantLock lock;
/** The compression level */
- private int compressionLevel;
+ private volatile int compressionLevel;
/**
* @param backend the backend storage