Author: bstansberry(a)jboss.com
Date: 2008-10-25 00:57:27 -0400 (Sat, 25 Oct 2008)
New Revision: 2001
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java
Log:
Show client status on chart panels
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java
===================================================================
---
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java 2008-10-24
17:51:24 UTC (rev 2000)
+++
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java 2008-10-25
04:57:27 UTC (rev 2001)
@@ -55,6 +55,12 @@
private JLabel totalClientsLabel;
private JLabel liveClientsLabel;
private JLabel failedClientsLabel;
+ private JLabel totalClientsLabelReq;
+ private JLabel liveClientsLabelReq;
+ private JLabel failedClientsLabelReq;
+ private JLabel totalClientsLabelSess;
+ private JLabel liveClientsLabelSess;
+ private JLabel failedClientsLabelSess;
/**
* Launch the application
@@ -121,17 +127,175 @@
controlPanel.setLayout(gridBagLayout);
tabbedPane.addTab("Control", null, controlPanel, null);
- final JPanel requestBalancingPanel = new
ChartPanel(this.chartManager.getRequestBalancingChart(), true);
+ final JPanel requestBalancingPanel = new JPanel();
+ gridBagLayout = new GridBagLayout();
+ gridBagLayout.columnWidths = new int[] {0};
+ gridBagLayout.rowHeights = new int[] {0, 0};
+ requestBalancingPanel.setLayout(gridBagLayout);
+
+ final JPanel requestChart = new
ChartPanel(this.chartManager.getRequestBalancingChart(), true);
+ GridBagConstraints gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.weightx = 1;
+ gridBagConstraints.weighty = 1;
+ gridBagConstraints.fill = GridBagConstraints.BOTH;
+ requestBalancingPanel.add(requestChart, gridBagConstraints);
+
+ JPanel clientStatusPanel = new JPanel();
+ gridBagLayout = new GridBagLayout();
+ gridBagLayout.columnWidths = new int[] {7,0,7,0,7,0,7,0,7,0,7,0,7};
+ gridBagLayout.rowHeights = new int[] {7,0};
+ clientStatusPanel.setLayout(gridBagLayout);
+
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.weightx = 1;
+ gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+ requestBalancingPanel.add(clientStatusPanel, gridBagConstraints);
+
+ JLabel label = new JLabel();
+ label.setText("Total clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ totalClientsLabelReq = new JLabel();
+ totalClientsLabelReq.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(totalClientsLabelReq, gridBagConstraints);
+
+ label = new JLabel();
+ label.setText("Live clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ liveClientsLabelReq = new JLabel();
+ liveClientsLabelReq.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 7;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(liveClientsLabelReq, gridBagConstraints);
+
+ label = new JLabel();
+ label.setText("Failed clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 9;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ failedClientsLabelReq = new JLabel();
+ failedClientsLabelReq.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 11;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(failedClientsLabelReq, gridBagConstraints);
+
tabbedPane.addTab("Request Balancing", null, requestBalancingPanel,
null);
- final JPanel sessionBalancingPanel = new
ChartPanel(this.chartManager.getSessionBalancingChart(), true);
+ final JPanel sessionBalancingPanel = new JPanel();
+ gridBagLayout = new GridBagLayout();
+ gridBagLayout.columnWidths = new int[] {0};
+ gridBagLayout.rowHeights = new int[] {0, 0};
+ sessionBalancingPanel.setLayout(gridBagLayout);
+
tabbedPane.addTab("Session Balancing", null, sessionBalancingPanel,
null);
+ JPanel sessionBalancingChart = new
ChartPanel(this.chartManager.getSessionBalancingChart(), true);
+
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.weightx = 1;
+ gridBagConstraints.weighty = 1;
+ gridBagConstraints.fill = GridBagConstraints.BOTH;
+ sessionBalancingPanel.add(sessionBalancingChart, gridBagConstraints);
+
+ clientStatusPanel = new JPanel();
+ gridBagLayout = new GridBagLayout();
+ gridBagLayout.columnWidths = new int[] {7,0,7,0,7,0,7,0,7,0,7,0,7};
+ gridBagLayout.rowHeights = new int[] {7,0};
+ clientStatusPanel.setLayout(gridBagLayout);
+
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.weightx = 1;
+ gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+ requestBalancingPanel.add(clientStatusPanel, gridBagConstraints);
+
+ label = new JLabel();
+ label.setText("Total clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ totalClientsLabelSess = new JLabel();
+ totalClientsLabelSess.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(totalClientsLabelSess, gridBagConstraints);
+
+ label = new JLabel();
+ label.setText("Live clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ liveClientsLabelSess = new JLabel();
+ liveClientsLabelSess.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 7;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(liveClientsLabelSess, gridBagConstraints);
+
+ label = new JLabel();
+ label.setText("Failed clients:");
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 9;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(label, gridBagConstraints);
+
+ failedClientsLabelSess = new JLabel();
+ failedClientsLabelSess.setText(String.valueOf("0"));
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 11;
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ clientStatusPanel.add(failedClientsLabelSess, gridBagConstraints);
+
+ gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.weightx = 1;
+ gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+ sessionBalancingPanel.add(clientStatusPanel, gridBagConstraints);
+
// Control panel contents
- JLabel label = new JLabel();
+ label = new JLabel();
label.setText("Host name:");
- GridBagConstraints gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridy = 0;
gridBagConstraints.gridx = 1;
gridBagConstraints.weighty = 1;
@@ -428,9 +592,17 @@
ClientStatus status = requestDriver.getClientStatus();
totalClientsLabel.setText(String.valueOf(status.clientCount));
liveClientsLabel.setText(String.valueOf(status.liveClientCount));
+ totalClientsLabelReq.setText(String.valueOf(status.clientCount));
+ liveClientsLabelReq.setText(String.valueOf(status.liveClientCount));
+ totalClientsLabelSess.setText(String.valueOf(status.clientCount));
+ liveClientsLabelSess.setText(String.valueOf(status.liveClientCount));
int failedCount = status.clientCount - status.successfulClientCount;
failedClientsLabel.setText(String.valueOf(failedCount));
failedClientsLabel.setForeground(failedCount == 0 ? Color.BLACK : Color.RED);
+ failedClientsLabelReq.setText(String.valueOf(failedCount));
+ failedClientsLabelReq.setForeground(failedCount == 0 ? Color.BLACK : Color.RED);
+ failedClientsLabelSess.setText(String.valueOf(failedCount));
+ failedClientsLabelSess.setForeground(failedCount == 0 ? Color.BLACK : Color.RED);
}
private class GUIUpdateTimerTask extends TimerTask