Search in sources :

Example 1 with StandardGarbageCollectionStatus

use of org.apache.nifi.controller.status.history.StandardGarbageCollectionStatus in project nifi by apache.

the class FlowController method getGarbageCollectionStatus.

public List<GarbageCollectionStatus> getGarbageCollectionStatus() {
    final List<GarbageCollectionStatus> statuses = new ArrayList<>();
    final Date now = new Date();
    for (final GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) {
        final String managerName = mbean.getName();
        final long count = mbean.getCollectionCount();
        final long millis = mbean.getCollectionTime();
        final GarbageCollectionStatus status = new StandardGarbageCollectionStatus(managerName, now, count, millis);
        statuses.add(status);
    }
    return statuses;
}
Also used : StandardGarbageCollectionStatus(org.apache.nifi.controller.status.history.StandardGarbageCollectionStatus) ArrayList(java.util.ArrayList) GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) GarbageCollectionStatus(org.apache.nifi.controller.status.history.GarbageCollectionStatus) StandardGarbageCollectionStatus(org.apache.nifi.controller.status.history.StandardGarbageCollectionStatus) Date(java.util.Date)

Aggregations

GarbageCollectorMXBean (java.lang.management.GarbageCollectorMXBean)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 GarbageCollectionStatus (org.apache.nifi.controller.status.history.GarbageCollectionStatus)1 StandardGarbageCollectionStatus (org.apache.nifi.controller.status.history.StandardGarbageCollectionStatus)1