|
|
@ -18,11 +18,12 @@ package org.springframework.boot.actuate.metrics.util;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.NavigableMap;
|
|
|
|
import java.util.NavigableMap;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
import java.util.concurrent.ConcurrentMap;
|
|
|
|
import java.util.concurrent.ConcurrentMap;
|
|
|
|
import java.util.concurrent.ConcurrentNavigableMap;
|
|
|
|
import java.util.concurrent.ConcurrentNavigableMap;
|
|
|
|
import java.util.concurrent.ConcurrentSkipListMap;
|
|
|
|
import java.util.concurrent.ConcurrentSkipListMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.ConcurrentReferenceHashMap;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Repository utility that stores stuff in memory with period-separated String keys.
|
|
|
|
* Repository utility that stores stuff in memory with period-separated String keys.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -30,9 +31,9 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class SimpleInMemoryRepository<T> {
|
|
|
|
public class SimpleInMemoryRepository<T> {
|
|
|
|
|
|
|
|
|
|
|
|
private final ConcurrentNavigableMap<String, T> values = new ConcurrentSkipListMap<String, T>();
|
|
|
|
private ConcurrentNavigableMap<String, T> values = new ConcurrentSkipListMap<String, T>();
|
|
|
|
|
|
|
|
|
|
|
|
private final ConcurrentMap<String, Object> locks = new ConcurrentHashMap<String, Object>();
|
|
|
|
private final ConcurrentMap<String, Object> locks = new ConcurrentReferenceHashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
|
|
public static interface Callback<T> {
|
|
|
|
public static interface Callback<T> {
|
|
|
|
T modify(T current);
|
|
|
|
T modify(T current);
|
|
|
@ -96,6 +97,10 @@ public class SimpleInMemoryRepository<T> {
|
|
|
|
.values());
|
|
|
|
.values());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setValues(ConcurrentNavigableMap<String, T> values) {
|
|
|
|
|
|
|
|
this.values = values;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected NavigableMap<String, T> getValues() {
|
|
|
|
protected NavigableMap<String, T> getValues() {
|
|
|
|
return this.values;
|
|
|
|
return this.values;
|
|
|
|
}
|
|
|
|
}
|
|
|
|