Search in sources :

Example 1 with ArrayOfPerfCounterInfo

use of com.vmware.vim25.ArrayOfPerfCounterInfo in project photon-model by vmware.

the class StatsClient method createLookup.

/**
 * cache perfCounters per connections. The call is slow as the response can be about 400kb
 * of xml.
 * @param conn
 * @return
 */
private static PerfCounterLookup createLookup(Connection conn) {
    return lookups.computeIfAbsent(conn.getURI(), u -> {
        GetMoRef get = new GetMoRef(conn);
        ArrayOfPerfCounterInfo counters;
        try {
            counters = get.entityProp(PERF_MGR_MOREF, PROP_PERF_COUNTER);
        } catch (Exception e) {
            throw new RuntimeException("cannot create lookup for " + u, e);
        }
        return new PerfCounterLookup(counters.getPerfCounterInfo());
    });
}
Also used : GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) ArrayOfPerfCounterInfo(com.vmware.vim25.ArrayOfPerfCounterInfo)

Aggregations

GetMoRef (com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef)1 ArrayOfPerfCounterInfo (com.vmware.vim25.ArrayOfPerfCounterInfo)1