public V get(K key) {
V value = this.eden.get(key);
if (value == null) {
- value = this.longterm.get(key);
+ synchronized (longterm) {
+ value = this.longterm.get(key);
+ }
if (value != null) {
this.eden.put(key, value);
}
public void put(K key, V value) {
if (this.eden.size() >= this.size) {
- this.longterm.putAll(this.eden);
+ synchronized (longterm) {
+ this.longterm.putAll(this.eden);
+ }
this.eden.clear();
}
this.eden.put(key, value);
*/
public final class ExpressionBuilder implements NodeVisitor {
- private static final ConcurrentCache<String, Node> cache = new ConcurrentCache<String, Node>(5000);
+ private static final ConcurrentCache<String, Node> cache =
+ new ConcurrentCache<String, Node>(5000);
private FunctionMapper fnMapper;
public V get(K k) {
V v = this.eden.get(k);
if (v == null) {
- v = this.longterm.get(k);
+ synchronized (longterm) {
+ v = this.longterm.get(k);
+ }
if (v != null) {
this.eden.put(k, v);
}
public void put(K k, V v) {
if (this.eden.size() >= size) {
- this.longterm.putAll(this.eden);
+ synchronized (longterm) {
+ this.longterm.putAll(this.eden);
+ }
this.eden.clear();
}
this.eden.put(k, v);