if (cntAn != null) { int interval=cntAn.interval(); CounterExecutingManager.getInstance().putCounter(new Invocation(c.newInstance(), m[i], interval)); counterCount++; if (icntAnot != null) { int interval=icntAnot.interval(); CounterExecutingManager.getInstance().putInteractionCounter(new Invocation(c.newInstance(), m[i], interval)); interactionCounterCount++;
public void run() { while (true) { ThreadUtil.sleep(1000); if (conf.counter_enabled == false) { continue; } long now = System.currentTimeMillis(); CounterBasket pw = new CounterBasket(); for (int i = 0; i < taskSec.size(); i++) { CountStat r = taskSec.get(i); try { if (r.counter.interval() <= now - r.xtime) { r.xtime = now; r.counter.process(pw); } } catch (Throwable t) { t.printStackTrace(); } } // PerfCounterPack[] pks = pw.getList(); DataProxy.sendCounter(pks); } } private CounterExecutingManager() {
if (cntAn != null) { int interval=cntAn.interval(); CounterExecutingManager.getInstance().putCounter(new Invocation(c.newInstance(), m[i], interval)); counterCount++; if (icntAnot != null) { int interval=icntAnot.interval(); CounterExecutingManager.getInstance().putInteractionCounter(new Invocation(c.newInstance(), m[i], interval)); interactionCounterCount++;
private void gatherAndSendInteractionCounter(long now) { InteractionCounterBasket basket = new InteractionCounterBasket(); for (int i = 0; i < interactionCountStatList.size(); i++) { CountStat stat = interactionCountStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } InteractionPerfCounterPack[] packs = basket.geAllAsArray(); if (packs != null && packs.length > 0) { DataProxy.sendCounter(packs); } }
private void gatherAndSendCounter(long now) { CounterBasket basket = new CounterBasket(); for (int i = 0; i < countStatList.size(); i++) { CountStat stat = countStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } PerfCounterPack[] packs = basket.getList(); DataProxy.sendCounter(packs); }
public static void load() { Set<String> defaultTasks = new Scanner("scouter.agent.counter.task").process(); Set<String> customTasks = new Scanner(System.getProperty("scouter.task")).process(); defaultTasks.addAll(customTasks); int n = 0; Iterator<String> itr = defaultTasks.iterator(); while (itr.hasNext()) { try { Class c = Class.forName(itr.next()); if (Modifier.isPublic(c.getModifiers()) == false) continue; Method[] m = c.getDeclaredMethods(); for (int i = 0; i < m.length; i++) { Counter mapAn = (Counter) m[i].getAnnotation(Counter.class); if (mapAn == null) continue; int interval=mapAn.interval(); CounterExecutingManager.getInstance().put(new Invocation(c.newInstance(), m[i], interval)); n++; } } catch (Throwable t) { scouter.agent.Logger.println("A112", ThreadUtil.getStackTrace(t)); } } scouter.agent.Logger.println("A113", "Counter Collector Started (#" + n + ")"); } public static void main(String[] args) {
if (cntAn != null) { int interval=cntAn.interval(); CounterExecutingManager.getInstance().putCounter(new Invocation(c.newInstance(), m[i], interval)); counterCount++; if (icntAnot != null) { int interval=icntAnot.interval(); CounterExecutingManager.getInstance().putInteractionCounter(new Invocation(c.newInstance(), m[i], interval)); interactionCounterCount++;
private void gatherAndSendInteractionCounter(long now) { InteractionCounterBasket basket = new InteractionCounterBasket(); for (int i = 0; i < interactionCountStatList.size(); i++) { CountStat stat = interactionCountStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } InteractionPerfCounterPack[] packs = basket.geAllAsArray(); if (packs != null && packs.length > 0) { DataProxy.sendCounter(packs); } }
private void gatherAndSendCounter(long now) { CounterBasket basket = new CounterBasket(); for (int i = 0; i < countStatList.size(); i++) { CountStat stat = countStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } PerfCounterPack[] packs = basket.getList(); DataProxy.sendCounter(packs); }
private void gatherAndSendCounter(long now) { CounterBasket basket = new CounterBasket(); for (int i = 0; i < countStatList.size(); i++) { CountStat stat = countStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } PerfCounterPack[] packs = basket.getList(); DataProxy.sendCounter(packs); }
private void gatherAndSendInteractionCounter(long now) { InteractionCounterBasket basket = new InteractionCounterBasket(); for (int i = 0; i < interactionCountStatList.size(); i++) { CountStat stat = interactionCountStatList.get(i); try { if (stat.counter.interval() <= now - stat.xtime) { stat.xtime = now; stat.counter.process(basket); } } catch (Throwable t) { t.printStackTrace(); } } InteractionPerfCounterPack[] packs = basket.geAllAsArray(); if (packs != null && packs.length > 0) { DataProxy.sendCounter(packs); } }