class ThreadLocalArriveTimeHolder {

    private static FastThreadLocal<WeakHashMap<Channel, Map<Integer, Long>>> arriveTimeInNano = new FastThreadLocal<WeakHashMap<Channel, Map<Integer, Long>>>();

    public static void arrive(Channel channel, Integer key) {
        Map<Integer, Long> map = getArriveTimeMap(channel);
        if (map.get(key) == null) {
            map.put(key, System.nanoTime());
        }
    }

    public static long getAndClear(Channel channel, Integer key) {
        Map<Integer, Long> map = getArriveTimeMap(channel);
        Long result = map.remove(key);
        if (result == null) {
            return -1;
        }
        return result;
    }

    private static Map<Integer, Long> getArriveTimeMap(Channel channel) {<FILL_FUNCTION_BODY>}
}

        WeakHashMap<Channel, Map<Integer, Long>> map = arriveTimeInNano.get();
        if (map == null) {
            arriveTimeInNano.set(new WeakHashMap<Channel, Map<Integer, Long>>(256));
            map = arriveTimeInNano.get();
        }
        Map<Integer, Long> subMap = map.get(channel);
        if (subMap == null) {
            map.put(channel, new HashMap<Integer, Long>());
        }
        return map.get(channel);
    
<no_super_class>