Search in sources :

Example 1 with CoherenceMachinePanel

use of com.oracle.coherence.plugin.visualvm.panel.CoherenceMachinePanel 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;
}
Also used : CoherenceGrpcProxyPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceGrpcProxyPanel) ActionEvent(java.awt.event.ActionEvent) CoherenceHttpSessionPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceHttpSessionPanel) CoherenceProxyPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceProxyPanel) CoherenceServicePanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceServicePanel) AbstractCoherencePanel(com.oracle.coherence.plugin.visualvm.panel.AbstractCoherencePanel) CoherenceClusterOverviewPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceClusterOverviewPanel) CoherenceMachinePanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceMachinePanel) CoherenceTopicPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceTopicPanel) CoherenceHotCachePanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceHotCachePanel) CoherenceJCachePanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceJCachePanel) CoherenceCachePanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceCachePanel) CoherenceHttpProxyPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceHttpProxyPanel) CoherenceElasticDataPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceElasticDataPanel) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) CoherencePersistencePanel(com.oracle.coherence.plugin.visualvm.panel.CoherencePersistencePanel) CoherenceClusterSnapshotPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceClusterSnapshotPanel) CoherenceMemberPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceMemberPanel) Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) CoherenceFederationPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceFederationPanel) DataViewComponent(org.graalvm.visualvm.core.ui.components.DataViewComponent) JEditorPane(javax.swing.JEditorPane) CoherenceExecutorPanel(com.oracle.coherence.plugin.visualvm.panel.CoherenceExecutorPanel) Map(java.util.Map)

Aggregations

AbstractCoherencePanel (com.oracle.coherence.plugin.visualvm.panel.AbstractCoherencePanel)1 CoherenceCachePanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceCachePanel)1 CoherenceClusterOverviewPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceClusterOverviewPanel)1 CoherenceClusterSnapshotPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceClusterSnapshotPanel)1 CoherenceElasticDataPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceElasticDataPanel)1 CoherenceExecutorPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceExecutorPanel)1 CoherenceFederationPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceFederationPanel)1 CoherenceGrpcProxyPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceGrpcProxyPanel)1 CoherenceHotCachePanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceHotCachePanel)1 CoherenceHttpProxyPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceHttpProxyPanel)1 CoherenceHttpSessionPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceHttpSessionPanel)1 CoherenceJCachePanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceJCachePanel)1 CoherenceMachinePanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceMachinePanel)1 CoherenceMemberPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceMemberPanel)1 CoherencePersistencePanel (com.oracle.coherence.plugin.visualvm.panel.CoherencePersistencePanel)1 CoherenceProxyPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceProxyPanel)1 CoherenceServicePanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceServicePanel)1 CoherenceTopicPanel (com.oracle.coherence.plugin.visualvm.panel.CoherenceTopicPanel)1 ClusterData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData)1 Data (com.oracle.coherence.plugin.visualvm.tablemodel.model.Data)1