mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-24 04:06:34 +10:00
[강운덕] [LUCYSUS-1744] 비동기 메시지 추적 부분 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@855 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.profiler.context;
|
||||
|
||||
import com.profiler.sender.DataSender;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class GlobalCallTrace<T> {
|
||||
private static AtomicInteger timerId = new AtomicInteger(0);
|
||||
|
||||
private ConcurrentMap<Integer, T> trace = new ConcurrentHashMap<Integer, T>(32);
|
||||
private AtomicInteger idGenerator = new AtomicInteger(0);
|
||||
private DataSender dataSender;
|
||||
|
||||
private Timer timer = new Timer("GlobalCallTrace-Timer-" + timerId.getAndIncrement(), true);
|
||||
|
||||
public int registerTraceObject(T target) {
|
||||
int id = idGenerator.getAndIncrement();
|
||||
trace.put(id, target);
|
||||
return id;
|
||||
}
|
||||
|
||||
public T removeTraceObject(int id) {
|
||||
return trace.get(id);
|
||||
}
|
||||
|
||||
public void setDataSender(DataSender dataSender) {
|
||||
this.dataSender = dataSender;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user