提交 838cd887 编写于 作者: oldratlee's avatar oldratlee 🔥

add new method in DataSource DUBBO-122 Provider的线程池监控支持

上级 39668263
......@@ -18,12 +18,19 @@ package com.alibaba.dubbo.common.store;
import com.alibaba.dubbo.common.extension.SPI;
import java.util.Map;
/**
* @author <a href="mailto:gang.lvg@alibaba-inc.com">kimi</a>
*/
@SPI("simple")
public interface DataStore {
/**
* return a snapshot value of componentName
*/
Map<String,Object> get(String componentName);
Object get(String componentName, String key);
void put(String componentName, String key, Object value);
......
......@@ -16,6 +16,7 @@
package com.alibaba.dubbo.common.store.support;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
......@@ -32,6 +33,13 @@ public class SimpleDataStore implements DataStore {
private ConcurrentMap<String, ConcurrentMap<String, Object>> data =
new ConcurrentHashMap<String, ConcurrentMap<String,Object>>();
public Map<String, Object> get(String componentName) {
ConcurrentMap<String, Object> value = data.get(componentName);
if(value == null) return new HashMap<String, Object>();
return new HashMap<String, Object>(value);
}
public Object get(String componentName, String key) {
if (!data.containsKey(componentName)) {
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册