use of com.oracle.coherence.plugin.visualvm.panel.CoherenceHotCachePanel in project coherence-visualvm by oracle.
the class VisualVMView method createComponent.
// ----- helpers --------------------------------------------------------
/**
* Create the new {@link DataViewComponent} which will display all the
* Coherence related information.
*/
@Override
protected DataViewComponent createComponent() {
final VisualVMModel model = VisualVMModel.getInstance();
boolean fClusterSnapshotEnabled = com.oracle.coherence.plugin.visualvm.GlobalPreferences.sharedInstance().isClusterSnapshotEnabled();
// Data area for master view
JEditorPane generalDataArea = new JEditorPane();
generalDataArea.setEditable(false);
// do an initial refresh of the data so we can see if we need to display
// the proxy server tab
model.refreshStatistics(requestSender);
model.setIsFirstRefresh(false);
// we then construct the panels after the initial refresh so we can utilize
// any information we have gathered in the startup
final CoherenceClusterSnapshotPanel pnlClusterSnapshot = fClusterSnapshotEnabled ? new CoherenceClusterSnapshotPanel(model) : null;
final CoherenceClusterOverviewPanel pnlClusterOverview = new CoherenceClusterOverviewPanel(model);
final CoherenceMachinePanel pnlMachine = new CoherenceMachinePanel(model);
final CoherenceMemberPanel pnlMember = new CoherenceMemberPanel(model);
final CoherenceServicePanel pnlService = new CoherenceServicePanel(model);
final CoherenceCachePanel pnlCache = new CoherenceCachePanel(model);
final CoherenceTopicPanel pnlTopic = new CoherenceTopicPanel(model);
final CoherenceProxyPanel pnlProxy = new CoherenceProxyPanel(model);
final CoherenceHotCachePanel pnlHotCache = new CoherenceHotCachePanel(model);
final CoherencePersistencePanel pnlPersistence = new CoherencePersistencePanel(model);
final CoherenceHttpSessionPanel pnlHttpSession = new CoherenceHttpSessionPanel(model);
final CoherenceFederationPanel pnlFederation = new CoherenceFederationPanel(model);
final CoherenceElasticDataPanel pnlElasticData = new CoherenceElasticDataPanel(model);
final CoherenceJCachePanel pnlJCache = new CoherenceJCachePanel(model);
final CoherenceHttpProxyPanel pnlHttpProxy = new CoherenceHttpProxyPanel(model);
final CoherenceExecutorPanel pnlExecutor = new CoherenceExecutorPanel(model);
final CoherenceGrpcProxyPanel pnlGrpcProxy = new CoherenceGrpcProxyPanel(model);
String sClusterVersion = model.getClusterVersion();
String sClusterName = null;
List<Map.Entry<Object, Data>> clusterData = model.getData(VisualVMModel.DataType.CLUSTER);
for (Map.Entry<Object, Data> entry : clusterData) {
sClusterName = entry.getValue().getColumn(ClusterData.CLUSTER_NAME).toString();
break;
}
// Master view:
DataViewComponent.MasterView masterView = new DataViewComponent.MasterView(Localization.getLocalText("LBL_cluster_information", sClusterName, sClusterVersion), null, generalDataArea);
// Configuration of master view:
DataViewComponent.MasterViewConfiguration masterConfiguration = new DataViewComponent.MasterViewConfiguration(false);
// Add the master view and configuration view to the component:
m_dvc = new DataViewComponent(masterView, masterConfiguration);
m_dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(Localization.getLocalText("LBL_cluster_overview"), false), DataViewComponent.TOP_RIGHT);
// Add detail views to the components
if (pnlClusterSnapshot != null) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_cluster_snapshot"), null, 10, pnlClusterSnapshot, null), DataViewComponent.TOP_RIGHT);
}
DataViewComponent.DetailsView clusterOverview = new DataViewComponent.DetailsView(Localization.getLocalText("LBL_cluster_overview"), null, 10, pnlClusterOverview, null);
m_dvc.addDetailsView(clusterOverview, DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_machines"), null, 10, pnlMachine, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_members"), null, 10, pnlMember, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_services"), null, 10, pnlService, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_caches"), null, 10, pnlCache, null), DataViewComponent.TOP_RIGHT);
// add the default panels
if (pnlClusterSnapshot != null) {
f_setPanels.add(pnlClusterSnapshot);
pnlClusterSnapshot.setRequestSender(requestSender);
}
f_setPanels.add(pnlClusterOverview);
f_setPanels.add(pnlMachine);
f_setPanels.add(pnlMember);
f_setPanels.add(pnlService);
f_setPanels.add(pnlCache);
if (model.isHotcacheConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_hotcache"), null, 10, pnlHotCache, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHotCache);
}
// selectively add tabs based upon used functionality
if (model.isFederationCongfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_federation"), null, 10, pnlFederation, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlFederation);
}
if (model.isCoherenceExtendConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_proxy_servers"), null, 10, pnlProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlProxy);
}
if (model.isHttpProxyConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_http_proxy_servers"), null, 10, pnlHttpProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHttpProxy);
}
if (model.isTopicsConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_topics"), null, 10, pnlTopic, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlTopic);
}
if (model.isPersistenceConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_persistence"), null, 10, pnlPersistence, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlPersistence);
}
if (model.isCoherenceWebConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_Coherence_web"), null, 10, pnlHttpSession, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHttpSession);
}
if (model.isElasticDataConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_elastic_data"), null, 10, pnlElasticData, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlElasticData);
}
if (model.isJCacheConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_JCache"), null, 10, pnlJCache, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlJCache);
}
if (model.isExecutorConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_executors"), null, 10, pnlExecutor, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlExecutor);
}
if (model.isGrpcProxyConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_grpc"), null, 10, pnlGrpcProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlGrpcProxy);
}
// update the request sender
pnlClusterOverview.setRequestSender(requestSender);
pnlMachine.setRequestSender(requestSender);
pnlMember.setRequestSender(requestSender);
pnlService.setRequestSender(requestSender);
pnlCache.setRequestSender(requestSender);
pnlHotCache.setRequestSender(requestSender);
pnlFederation.setRequestSender(requestSender);
pnlProxy.setRequestSender(requestSender);
pnlTopic.setRequestSender(requestSender);
pnlPersistence.setRequestSender(requestSender);
pnlHttpSession.setRequestSender(requestSender);
pnlElasticData.setRequestSender(requestSender);
pnlJCache.setRequestSender(requestSender);
pnlExecutor.setRequestSender(requestSender);
pnlGrpcProxy.setRequestSender(requestSender);
// using JMX queries rather than the reporter.
if (model.getDomainPartitions().size() > 1) {
JOptionPane.showMessageDialog(null, Localization.getLocalText("LBL_mt_warning"));
}
m_dvc.selectDetailsView(clusterOverview);
// create a timer that will refresh the TAB's as required every 3 seconds
// the reason for 3 seconds is so that with the min cluster data refresh time of
// 5 seconds, the updates will be smoother
m_timer = new Timer(3000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (refreshRunning) {
return;
}
refreshRunning = true;
RequestProcessor.getDefault().post(new Runnable() {
public void run() {
try {
// application may be null inside the constructor
if (m_application == null || m_application.getState() == Application.STATE_AVAILABLE) {
// Schedule the SwingWorker to update the GUI
model.refreshStatistics(requestSender);
// refresh only the panels that were activated on startup
for (AbstractCoherencePanel panel : f_setPanels) {
panel.updateData();
panel.updateGUI();
}
}
} catch (Exception ex) {
LOGGER.warning("Error while refreshing tabs. " + ex.toString());
ex.printStackTrace();
} finally {
refreshRunning = false;
}
}
});
}
});
m_timer.setInitialDelay(800);
m_timer.start();
return m_dvc;
}
Aggregations