Project

General

Profile

« Previous | Next » 

Revision 475575b3

Added by Patrick Plitzner over 4 years ago

Fix gcTime calculation

View differences:

cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/JvmMonitor.java
43 43

  
44 44
        //logger.setLevel(Level.DEBUG);
45 45

  
46
        long gcTime = -1;
46
        long gcTimeSum = -1;
47 47
        long collectorGcTime;
48 48
        for(GarbageCollectorMXBean gcMXBean : gcMXBeans){
49
                if(gcTime == -1) {
50
                    gcTime = 0;
49
                if(gcTimeSum == -1) {
50
                    gcTimeSum = 0;
51 51
                }
52 52
                collectorGcTime = gcMXBean.getCollectionTime();
53 53
                logger.debug("cgMxBean: " + gcMXBean.getName()
......
55 55
                        + " gcCount = " + gcMXBean.getCollectionCount());
56 56
                if(collectorGcTime != -1) {
57 57
                    // only sum up if the time is defined
58
                    gcTime = gcMXBean.getCollectionTime();
58
                    gcTimeSum += gcMXBean.getCollectionTime();
59 59
                }
60 60
        }
61
        logger.debug("gcTimeSum = " + gcTime);
62
        return gcTime;
61
        logger.debug("gcTimeSum = " + gcTimeSum);
62
        return gcTimeSum;
63 63

  
64 64
    }
65 65

  

Also available in: Unified diff