Package com.blogspot.ostas.monitoring.statistics

Examples of com.blogspot.ostas.monitoring.statistics.MethodInvocationStats


        try {
            return methodInvocation.proceed();
        } finally {
            long execTime = System.currentTimeMillis() - start;
            final String methodID = methodNamingStrategy.getMethodAsString(currentMethod);
            MethodInvocationStats methodInvocationStats = methodInvocationStatsMap.get(methodID);
            if (methodInvocationStats == null) {
                LOGGER.error("method is null : " + methodID);
                throw new RuntimeException("Method with id : " + methodID + " not found in stats map : " + methodInvocationStatsMap.keySet());
            }
            if (methodInvocationStats.getHits().longValue() == -1l) {
                methodInvocationStats.setHits(new AtomicLong(1));
                methodInvocationStats.setLatestExecTime(new AtomicLong(execTime));
                methodInvocationStats.setTotalExecTime(new AtomicLong(execTime));
                methodInvocationStats.setMinExecTime(new AtomicLong(execTime));
                methodInvocationStats.setMaxExecTime(new AtomicLong(execTime));
            } else {
                methodInvocationStats.getHits().incrementAndGet();
                methodInvocationStats.getLatestExecTime().set(execTime);
                methodInvocationStats.getTotalExecTime().addAndGet(methodInvocationStats.getLatestExecTime().get());
                if (methodInvocationStats.getMaxExecTime().get() < execTime) {
                    methodInvocationStats.getMaxExecTime().set(execTime);
                }
                if (methodInvocationStats.getMinExecTime().get() > execTime) {
                    methodInvocationStats.getMinExecTime().set(execTime);
                }
            }

            if (DEBUG) {
                LOGGER.debug(new StringBuilder()
View Full Code Here


        return calculateStatsOnMethodInvocation(methodInvocation);
    }

    public void clearStats() {
        for (final Map.Entry<String, MethodInvocationStats> methodInvocationStats : methodInvocationStatsMap.entrySet()) {
            MethodInvocationStats invocationStats = new MethodInvocationStats();
            invocationStats.setHits(new AtomicLong(-1));
            invocationStats.setLatestExecTime(new AtomicLong(0));
            invocationStats.setMinExecTime(new AtomicLong(0));
            invocationStats.setTotalExecTime(new AtomicLong(0));
            methodInvocationStats.setValue(invocationStats);
        }
    }
View Full Code Here

                    if(Modifier.isPublic(method.getModifiers())){
                        if(methodMatcher.matches(method, clazz,method.getParameterTypes())){
                            if(LOGGER.isDebugEnabled()){
                                LOGGER.debug("method matches pointcut : "+method);
                            }
                            MethodInvocationStats emptyMethodInvocationStats = new MethodInvocationStats();
                            emptyMethodInvocationStats.setHits(new AtomicLong(-1));
                            performanceMonitoringInterceptor.getMethodInvocationStatsMap().put(methodNamingStrategy.getMethodAsString(method), emptyMethodInvocationStats);
                        }
                    }
                }
        }
View Full Code Here

        try {
            return methodInvocation.proceed();
        } finally {
            long execTime = System.currentTimeMillis() - start;
            final String methodID = methodNamingStrategy.getMethodAsString(currentMethod);
            MethodInvocationStats methodInvocationStats = methodInvocationStatsMap.get(methodID);
            if (methodInvocationStats == null) {
                LOGGER.error("method is null : " + methodID);
                throw new RuntimeException("Method with id : " + methodID + " not found in stats map : " + methodInvocationStatsMap.keySet());
            }
            if (methodInvocationStats.getHits().longValue() == -1l) {
                methodInvocationStats.setHits(new AtomicLong(1));
                methodInvocationStats.setLatestExecTime(new AtomicLong(execTime));
                methodInvocationStats.setTotalExecTime(new AtomicLong(execTime));
                methodInvocationStats.setMinExecTime(new AtomicLong(execTime));
                methodInvocationStats.setMaxExecTime(new AtomicLong(execTime));
            } else {
                methodInvocationStats.getHits().incrementAndGet();
                methodInvocationStats.getLatestExecTime().set(execTime);
                methodInvocationStats.getTotalExecTime().addAndGet(methodInvocationStats.getLatestExecTime().get());
                if (methodInvocationStats.getMaxExecTime().get() < execTime) {
                    methodInvocationStats.getMaxExecTime().set(execTime);
                }
                if (methodInvocationStats.getMinExecTime().get() > execTime) {
                    methodInvocationStats.getMinExecTime().set(execTime);
                }
            }

            if (DEBUG) {
                LOGGER.debug(new StringBuilder()
View Full Code Here

        return calculateStatsOnMethodInvocation(methodInvocation);
    }

    public void clearStats() {
        for (final Map.Entry<String, MethodInvocationStats> methodInvocationStats : methodInvocationStatsMap.entrySet()) {
            MethodInvocationStats invocationStats = new MethodInvocationStats();
            invocationStats.setHits(new AtomicLong(-1));
            invocationStats.setLatestExecTime(new AtomicLong(0));
            invocationStats.setMinExecTime(new AtomicLong(0));
            invocationStats.setTotalExecTime(new AtomicLong(0));
            methodInvocationStats.setValue(invocationStats);
        }
    }
View Full Code Here

                    if(Modifier.isPublic(method.getModifiers())){
                        if(methodMatcher.matches(method,pojoClass,method.getParameterTypes())){
                            if(LOGGER.isDebugEnabled()){
                                LOGGER.debug("method matches pointcut : "+method);
                            }
                            MethodInvocationStats emptyMethodInvocationStats = new MethodInvocationStats();
                            emptyMethodInvocationStats.setHits(new AtomicLong(-1));
                            performanceMonitoringInterceptor.getMethodInvocationStatsMap().put(methodNamingStrategy.getMethodAsString(method), emptyMethodInvocationStats);
                        }
                    }
                }
        }
View Full Code Here

TOP

Related Classes of com.blogspot.ostas.monitoring.statistics.MethodInvocationStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.