提交 a90a803e authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting

上级 18cb1b4a
......@@ -9,14 +9,14 @@ import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
/**
* Similar to ThreadLocal, except that it allows it's data to be read from other threads - useful for debugging info.
* Similar to ThreadLocal, except that it allows it's data to be read from other
* threads - useful for debugging info.
*
* @param <T> the type
*/
public class DebuggingThreadLocal<T>
{
private final ConcurrentHashMap<Long, T> map = new ConcurrentHashMap<Long, T>();
public class DebuggingThreadLocal<T> {
public DebuggingThreadLocal() {
}
private final ConcurrentHashMap<Long, T> map = new ConcurrentHashMap<Long, T>();
public void set(T value) {
map.put(Thread.currentThread().getId(), value);
......@@ -33,8 +33,8 @@ public class DebuggingThreadLocal<T>
/**
* @return a HashMap containing a mapping from thread-id to value
*/
public HashMap<Long,T> getSnapshotOfAllThreads() {
return new HashMap<Long,T>(map);
public HashMap<Long, T> getSnapshotOfAllThreads() {
return new HashMap<Long, T>(map);
}
public T deepCopy(T value) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论