use of com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData in project coherence-visualvm by oracle.
the class VisualVMModel method init.
// ---- helper methods --------------------------------------------------
/**
* Initialize anything for this instance of the model.
*/
private void init() {
m_nRefreshTime = getRefreshTime();
m_fLogJMXQueryTimes = isLogQueryTimes();
String sReporterDisabled = System.getProperty(PROP_REPORTER_DISABLED);
// version >= 12.1.3
if ("true".equalsIgnoreCase(sReporterDisabled)) {
setReporterAvailable(false);
}
// force update on first time
m_ldtLastUpdate = System.currentTimeMillis() - m_nRefreshTime - 1L;
// populate mapCollectedData which contains an entry for each type
m_mapCollectedData = new HashMap<DataType, List<Entry<Object, Data>>>();
for (DataType type : DataType.values()) {
m_mapCollectedData.put(type, null);
}
// intialize the data retrievers map
f_mapDataRetrievers.put(CacheData.class, new CacheData());
f_mapDataRetrievers.put(ClusterData.class, new ClusterData());
f_mapDataRetrievers.put(MemberData.class, new MemberData());
f_mapDataRetrievers.put(ServiceData.class, new ServiceData());
f_mapDataRetrievers.put(ServiceMemberData.class, new ServiceMemberData());
f_mapDataRetrievers.put(ProxyData.class, new ProxyData());
f_mapDataRetrievers.put(MachineData.class, new MachineData());
f_mapDataRetrievers.put(CacheDetailData.class, new CacheDetailData());
f_mapDataRetrievers.put(CacheFrontDetailData.class, new CacheFrontDetailData());
f_mapDataRetrievers.put(TopicData.class, new TopicData());
f_mapDataRetrievers.put(PersistenceData.class, new PersistenceData());
f_mapDataRetrievers.put(PersistenceNotificationsData.class, new PersistenceNotificationsData());
f_mapDataRetrievers.put(CacheStorageManagerData.class, new CacheStorageManagerData());
f_mapDataRetrievers.put(HttpSessionData.class, new HttpSessionData());
f_mapDataRetrievers.put(FederationDestinationData.class, new FederationDestinationData());
f_mapDataRetrievers.put(FederationDestinationDetailsData.class, new FederationDestinationDetailsData());
f_mapDataRetrievers.put(FederationOriginData.class, new FederationOriginData());
f_mapDataRetrievers.put(FederationOriginDetailsData.class, new FederationOriginDetailsData());
f_mapDataRetrievers.put(RamJournalData.class, new RamJournalData());
f_mapDataRetrievers.put(FlashJournalData.class, new FlashJournalData());
f_mapDataRetrievers.put(JCacheConfigurationData.class, new JCacheConfigurationData());
f_mapDataRetrievers.put(JCacheStatisticsData.class, new JCacheStatisticsData());
f_mapDataRetrievers.put(HttpProxyData.class, new HttpProxyData());
f_mapDataRetrievers.put(HttpProxyMemberData.class, new HttpProxyMemberData());
f_mapDataRetrievers.put(HotCacheData.class, new HotCacheData());
f_mapDataRetrievers.put(HotCachePerCacheData.class, new HotCachePerCacheData());
f_mapDataRetrievers.put(NodeStorageData.class, new NodeStorageData());
f_mapDataRetrievers.put(ExecutorData.class, new ExecutorData());
f_mapDataRetrievers.put(GrpcProxyData.class, new GrpcProxyData());
// Loop through each data retriever and initialize the map of
// report XML. Doing it this way we load it only once
Iterator<Map.Entry<Class, DataRetriever>> iter = f_mapDataRetrievers.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Class, DataRetriever> entry = iter.next();
String sReport = entry.getValue().getReporterReport();
if (sReport != null) {
String sReportXML = getReportXML(sReport);
if (sReportXML != null) {
f_mapReportXML.put(entry.getKey(), sReportXML);
}
}
}
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData in project coherence-visualvm by oracle.
the class CoherenceCachePanel method updateData.
// ---- AbstractCoherencePanel methods ----------------------------------
@Override
public void updateData() {
m_cacheData = f_model.getData(VisualVMModel.DataType.CACHE);
m_cacheDetailData = f_model.getData(VisualVMModel.DataType.CACHE_DETAIL);
m_cacheFrontDetailData = f_model.getData(VisualVMModel.DataType.CACHE_FRONT_DETAIL);
m_cacheStorageData = f_model.getData(VisualVMModel.DataType.CACHE_STORAGE_MANAGER);
// zero out memory if the selected cache is FIXED unit calculator
Tuple selectedCache = f_model.getSelectedCache();
if (selectedCache != null) {
boolean isFixed = false;
String sCache = selectedCache.toString();
// find the cacheData for this cache
for (Entry<Object, Data> entry : m_cacheData) {
if (entry.getKey().toString().equals(sCache) && entry.getValue().getColumn(CacheData.UNIT_CALCULATOR).equals("FIXED")) {
isFixed = true;
break;
}
}
if (isFixed) {
List<Entry<Object, Data>> tempList = new ArrayList<>();
if (m_cacheDetailData != null) {
// zero out the values for memory and update the list
for (Entry<Object, Data> entry : m_cacheDetailData) {
entry.getValue().setColumn(CacheDetailData.MEMORY_BYTES, Integer.valueOf(0));
tempList.add(entry);
}
}
m_cacheDetailData = tempList;
}
}
f_tmodel.setDataList(m_cacheData);
f_tmodelDetail.setDataList(m_cacheDetailData);
f_tmodelStorage.setDataList(m_cacheStorageData);
// check if near cache is configured
m_isNearCacheConfigured = m_cacheFrontDetailData != null && m_cacheFrontDetailData.size() > 0;
if (m_isNearCacheConfigured) {
f_tmodelFrontDetail.setDataList(m_cacheFrontDetailData);
}
// if we are currently displaying the heat map then update it
if (m_currentHeatMap != null) {
m_currentHeatMap.updateData();
m_currentHeatMap.m_pnlHeatMap.repaint();
}
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testCacheData.
/**
* Test the retrieval of CacheData via the VisualVMModel.
*/
private void testCacheData() throws Exception {
final int INSERT1_COUNT = 10000;
final int INSERT2_COUNT = 7500;
final int INSERT3_COUNT = 100;
final int DATA_SIZE = 250;
List<Map.Entry<Object, Data>> cacheData;
List<Map.Entry<Object, Data>> cacheDetailData;
List<Map.Entry<Object, Data>> cacheStorageData;
VisualVMModel model = getModel();
RequestSender requestSender = getRequestSender();
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.refreshStatistics(requestSender);
cacheData = model.getData(VisualVMModel.DataType.CACHE);
setCurrentDataType(VisualVMModel.DataType.CACHE);
setClientProperties();
ExtensibleConfigurableCacheFactory eccf = getECCF();
// now add 2 caches on 2 different services - note we are connecting via Extend
NamedCache nc1 = eccf.ensureCache(DIST1_CACHE, null);
NamedCache nc2 = eccf.ensureCache(DIST2_CACHE, null);
NamedCache nc3 = eccf.ensureCache(REPL_CACHE, null);
populateRandomData(nc1, INSERT1_COUNT, DATA_SIZE);
populateRandomData(nc2, INSERT2_COUNT, DATA_SIZE);
populateRandomData(nc3, INSERT3_COUNT, DATA_SIZE);
assertTrue(nc1.size() == INSERT1_COUNT);
assertTrue(nc2.size() == INSERT2_COUNT);
assertTrue(nc3.size() == INSERT3_COUNT);
waitForRefresh();
model.refreshStatistics(requestSender);
cacheData = model.getData(VisualVMModel.DataType.CACHE);
Map.Entry<Object, Data> distCache1 = getData(cacheData, new Pair<>(DIST1_SERVICE, DIST1_CACHE));
Map.Entry<Object, Data> distCache2 = getData(cacheData, new Pair<>(DIST2_SERVICE, DIST2_CACHE));
Map.Entry<Object, Data> replCache1 = getData(cacheData, new Pair<>(REPLICATED_SERVICE, REPL_CACHE));
// validate the data returned where its deterministic
validateColumnNotNull(CacheData.SIZE, distCache1);
validateColumn(CacheData.CACHE_NAME, distCache1, getCacheName(DIST1_SERVICE, DIST1_CACHE));
validateColumnNotNull(CacheData.SIZE, distCache2);
validateColumn(CacheData.CACHE_NAME, distCache2, getCacheName(DIST2_SERVICE, DIST2_CACHE));
validateColumnNotNull(CacheData.SIZE, replCache1);
validateColumn(CacheData.CACHE_NAME, replCache1, getCacheName(REPLICATED_SERVICE, REPL_CACHE));
validateColumn(CacheData.UNIT_CALCULATOR, distCache1, "BINARY");
// select the first service, which should then generate both CacheDetailData and
// CacheStorageManagerData on next refresh
model.setSelectedCache(new Pair<>(DIST1_SERVICE, DIST1_CACHE));
// do 2 gets
nc1.get(0);
nc1.get(INSERT1_COUNT - 1);
waitForRefresh();
model.refreshStatistics(getRequestSender());
cacheDetailData = model.getData(VisualVMModel.DataType.CACHE_DETAIL);
cacheStorageData = model.getData(VisualVMModel.DataType.CACHE_STORAGE_MANAGER);
setCurrentDataType(VisualVMModel.DataType.CACHE_DETAIL);
validateData(VisualVMModel.DataType.CACHE_DETAIL, cacheDetailData, 2);
setCurrentDataType(VisualVMModel.DataType.CACHE_STORAGE_MANAGER);
validateData(VisualVMModel.DataType.CACHE_STORAGE_MANAGER, cacheStorageData, 2);
// validate the CacheDetail data
Map.Entry<Object, Data> entryDetail1 = cacheDetailData.get(0);
Map.Entry<Object, Data> entryDetail2 = cacheDetailData.get(1);
validateColumn(CacheDetailData.NODE_ID, entryDetail1, 1);
validateColumn(CacheDetailData.NODE_ID, entryDetail2, 2);
// call the dependent tests as we can't guarantee execution order in JUnit
testPersistenceData();
testProxyData();
if (isCommercial()) {
testElasticData();
}
}
Aggregations