mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 16:56:15 +10:00
[강운덕] [LUCYSUS-1744] interceptor load 코드 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@533 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
package com.profiler.interceptor;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class InterceptorRegistry {
|
||||
|
||||
private static final ConcurrentMap<Integer, Interceptor> INTERCEPTOR_MAP = new ConcurrentHashMap<Integer, Interceptor>(256);
|
||||
private static final AtomicInteger ID = new AtomicInteger(0);
|
||||
|
||||
public static void addInterceptor(Integer key, Interceptor interceptor) {
|
||||
INTERCEPTOR_MAP.put(key, interceptor);
|
||||
private static int MAX = 1024;
|
||||
private static final Interceptor[] INDEX = new Interceptor[MAX];
|
||||
|
||||
public static int addInterceptor(Interceptor interceptor) {
|
||||
int id = ID.getAndIncrement();
|
||||
if (id > MAX) {
|
||||
throw new IllegalArgumentException("id" + id);
|
||||
}
|
||||
INDEX[id] = interceptor;
|
||||
return id;
|
||||
}
|
||||
|
||||
public static Interceptor getInterceptor(int key) {
|
||||
return INTERCEPTOR_MAP.get(key);
|
||||
return INDEX[key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user