Search in sources :

Example 1 with StatHistoryCacheEntry

use of org.ow2.proactive_grid_cloud_portal.common.StatHistoryCaching.StatHistoryCacheEntry in project scheduling by ow2-proactive.

the class RMRest method getStatHistory.

@Override
public String getStatHistory(String sessionId, String range1, String function) throws ReflectionException, InterruptedException, IntrospectionException, NotConnectedException, InstanceNotFoundException, MalformedObjectNameException, IOException {
    String newRange = MBeanInfoViewer.possibleModifyRange(range1, dataSources, 'a');
    StatHistoryCacheEntry entry = StatHistoryCaching.getInstance().getEntryOrCompute(newRange, () -> {
        RMProxyUserInterface rm = checkAccess(sessionId);
        AttributeList attrs = rm.getMBeanAttributes(new ObjectName(RMJMXBeans.RUNTIMEDATA_MBEAN_NAME), new String[] { "StatisticHistory" });
        Attribute attr = (Attribute) attrs.get(0);
        // content of the RRD4J database backing file
        byte[] rrd4j = (byte[]) attr.getValue();
        return MBeanInfoViewer.rrdContent(rrd4j, newRange, dataSources, function);
    });
    return entry.getValue();
}
Also used : StatHistoryCacheEntry(org.ow2.proactive_grid_cloud_portal.common.StatHistoryCaching.StatHistoryCacheEntry) Attribute(javax.management.Attribute) AttributeList(javax.management.AttributeList) RMProxyUserInterface(org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface) ObjectName(javax.management.ObjectName)

Aggregations

Attribute (javax.management.Attribute)1 AttributeList (javax.management.AttributeList)1 ObjectName (javax.management.ObjectName)1 RMProxyUserInterface (org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface)1 StatHistoryCacheEntry (org.ow2.proactive_grid_cloud_portal.common.StatHistoryCaching.StatHistoryCacheEntry)1