Author: jflesch
Date: 2007-04-01 15:09:39 +0000 (Sun, 01 Apr 2007)
New Revision: 12513
Added:
trunk/apps/Thaw/src/thaw/plugins/peerMonitor/Peer.java
trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
Modified:
trunk/apps/Thaw/src/thaw/fcp/FCPGetNode.java
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java
trunk/apps/Thaw/src/thaw/plugins/StatusBar.java
trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
Log:
Implement a thread counter in the PeerMonitor panel
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPGetNode.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPGetNode.java 2007-04-01 14:34:14 UTC
(rev 12512)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPGetNode.java 2007-04-01 15:09:39 UTC
(rev 12513)
@@ -37,7 +37,10 @@
public final static String netSizeSessionElement =
"volatile.networkSizeEstimateSession";
private int netSizeSession = 0;
+ public final static String nmbThreadsElement =
"volatile.runningThreadCount";
+ private int nmbThreads = 0;
+
private boolean withPrivate;
private boolean withVolatile;
@@ -98,6 +101,9 @@
if (msg.getValue(usedMemElement) != null)
usedMem =
Long.parseLong(msg.getValue(usedMemElement));
+
+ if (msg.getValue(nmbThreadsElement) != null)
+ nmbThreads =
Integer.parseInt(msg.getValue(nmbThreadsElement));
}
allParameters = msg.getValues();
@@ -120,6 +126,10 @@
return usedMem;
}
+ public int getNmbThreads() {
+ return nmbThreads;
+ }
+
public Hashtable getAllParameters() {
return allParameters;
}
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-01
14:34:14 UTC (rev 12512)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-01
15:09:39 UTC (rev 12513)
@@ -349,12 +349,14 @@
thaw.plugin.peerMonitor.infos.node.uptimeSeconds=Uptime
thaw.plugin.peerMonitor.infos.node.networkSizeEstimateSession=Estimation de la
taille du r?seau
thaw.plugin.peerMonitor.infos.node.myName=Nom du noeud
+
thaw.plugin.peerMonitor.infos.nodeMemory=Memoire du noeud
thaw.plugin.peerMonitor.infos.thawMemory=Memoire de Thaw
+thaw.plugin.peerMonitor.infos.nodeThreads=Threads (node)
+thaw.plugin.peerMonitor.infos.thawThreads=Threads (Thaw)
-
thaw.plugin.themeSelector.themeSelector=S?lecteur de th?me
thaw.plugin.themeSelector.selectATheme=Selectionnez un th?me:
thaw.plugin.themeSelector.theme=Th?me
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-01 14:34:14 UTC
(rev 12512)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-01 15:09:39 UTC
(rev 12513)
@@ -97,6 +97,7 @@
thaw.statusBar.disconnected=DISCONNECTED
thaw.statusBar.connecting=Connecting ...
+
## Config
thaw.config.windowName=Configuration
thaw.config.okButton=Ok
@@ -345,9 +346,10 @@
thaw.plugin.peerMonitor.infos.nodeMemory=Node memory
thaw.plugin.peerMonitor.infos.thawMemory=Thaw memory
+thaw.plugin.peerMonitor.infos.nodeThreads=Node threads
+thaw.plugin.peerMonitor.infos.thawThreads=Thaw threads
-
thaw.plugin.themeSelector.themeSelector=Theme selector
thaw.plugin.themeSelector.selectATheme=Select a theme:
thaw.plugin.themeSelector.theme=Theme
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-01 14:34:14 UTC
(rev 12512)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-01 15:09:39 UTC
(rev 12513)
@@ -349,12 +349,14 @@
thaw.plugin.peerMonitor.infos.node.uptimeSeconds=Uptime
thaw.plugin.peerMonitor.infos.node.networkSizeEstimateSession=Estimation de la
taille du r\u00e9seau
thaw.plugin.peerMonitor.infos.node.myName=Nom du noeud
+
thaw.plugin.peerMonitor.infos.nodeMemory=Memoire du noeud
thaw.plugin.peerMonitor.infos.thawMemory=Memoire de Thaw
+thaw.plugin.peerMonitor.infos.nodeThreads=Threads (node)
+thaw.plugin.peerMonitor.infos.thawThreads=Threads (Thaw)
-
thaw.plugin.themeSelector.themeSelector=S\u00e9lecteur de th\u00e8me
thaw.plugin.themeSelector.selectATheme=Selectionnez un th\u00e8me:
thaw.plugin.themeSelector.theme=Th\u00e8me
Modified: trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java 2007-04-01 14:34:14 UTC
(rev 12512)
+++ trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java 2007-04-01 15:09:39 UTC
(rev 12513)
@@ -27,6 +27,7 @@
private boolean advancedMode;
+
public PeerMonitor() {
}
@@ -76,6 +77,7 @@
FCPGetNode gN = (FCPGetNode)o;
peerPanel.setMemBar(gN.getUsedJavaMemory(),
gN.getMaxJavaMemory());
+ peerPanel.setNmbThreads(gN.getNmbThreads());
peerPanel.setNodeInfos(gN.getAllParameters());
if (!isRefSet) {
Modified: trunk/apps/Thaw/src/thaw/plugins/StatusBar.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/StatusBar.java 2007-04-01 14:34:14 UTC
(rev 12512)
+++ trunk/apps/Thaw/src/thaw/plugins/StatusBar.java 2007-04-01 15:09:39 UTC
(rev 12513)
@@ -123,6 +123,10 @@
+ Integer.toString(progressDone) + "/" +
Integer.toString(progressTotal);
}
+
+ int nmbThread = Thread.activeCount();
+
+
status = status
+ StatusBar.SEPARATOR +
I18n.getMessage("thaw.plugin.statistics.finished")+ " "
+ Integer.toString(finished) + "/" +
Integer.toString(total)
Added: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/Peer.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/Peer.java
(rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/Peer.java 2007-04-01
15:09:39 UTC (rev 12513)
@@ -0,0 +1,42 @@
+package thaw.plugins.peerMonitor;
+
+
+import java.awt.Color;
+
+import java.util.Hashtable;
+
+
+public class Peer {
+
+ private String displayName = null;
+ private Color textColor = Color.BLACK;
+ private Hashtable parameters = null;
+
+ public Peer(Hashtable parameters) {
+ this.parameters = parameters;
+ displayName = (String)parameters.get("myName");
+
+ String status = (String)parameters.get("volatile.status");
+
+ for (int i = 0 ; i < PeerMonitorPanel.STR_STATUS.length ; i++) {
+ if (PeerMonitorPanel.STR_STATUS[i].equals(status))
+ setTextColor(PeerMonitorPanel.COLOR_STATUS[i]);
+ }
+ }
+
+ public void setTextColor(Color c) {
+ textColor = c;
+ }
+
+ public Color getTextColor() {
+ return textColor;
+ }
+
+ public Hashtable getParameters() {
+ return parameters;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
Added: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
(rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
2007-04-01 15:09:39 UTC (rev 12513)
@@ -0,0 +1,9 @@
+package thaw.plugins.peerMonitor;
+
+
+public class PeerHelper {
+
+
+
+}
+
Modified: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
2007-04-01 14:34:14 UTC (rev 12512)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
2007-04-01 15:09:39 UTC (rev 12513)
@@ -41,7 +41,6 @@
*/
public class PeerMonitorPanel extends Observable implements ActionListener,
ListSelectionListener
{
- /* must match with color list */
public final static String[] STR_STATUS = {
"CONNECTED",
"BACKED OFF",
@@ -82,6 +81,9 @@
private JProgressBar thawMemBar;
private JProgressBar nodeMemBar;
+ private JLabel nodeThreads;
+ private JLabel thawThreads;
+
private JLabel detailsLabel;
private JPanel detailsPanel;
@@ -120,13 +122,20 @@
setMemBar(0, 134217728);
+ nodeThreads = new JLabel("");
+ thawThreads = new JLabel("");
+ JPanel threadPanel = new JPanel(new GridLayout(1, 2));
+ threadPanel.add(nodeThreads);
+ threadPanel.add(thawThreads);
+
peerPanel.add(peerListLabel, BorderLayout.NORTH);
peerPanel.add(new JScrollPane(peerList), BorderLayout.CENTER);
- JPanel memPanel = new JPanel(new GridLayout(2, 1));
+ JPanel memPanel = new JPanel(new GridLayout(3, 1));
memPanel.add(nodeMemBar);
memPanel.add(thawMemBar);
+ memPanel.add(threadPanel);
peerPanel.add(memPanel, BorderLayout.SOUTH);
@@ -206,47 +215,20 @@
}
- public void setRef(String ref) {
- refArea.setText(ref);
+ public void setNmbThreads(int nmbNodeThreads) {
+
nodeThreads.setText(I18n.getMessage("thaw.plugin.peerMonitor.infos.nodeThreads")
+ + ": "+ Integer.toString(nmbNodeThreads));
+
thawThreads.setText(I18n.getMessage("thaw.plugin.peerMonitor.infos.thawThreads")
+ + ": "+
Integer.toString(Thread.activeCount()));
}
-
- protected class Peer {
- private String displayName = null;
- private Color textColor = Color.BLACK;
- private Hashtable parameters = null;
-
- public Peer(Hashtable parameters) {
- this.parameters = parameters;
- displayName = (String)parameters.get("myName");
-
- String status =
(String)parameters.get("volatile.status");
-
- for (int i = 0 ; i < STR_STATUS.length ; i++) {
- if (STR_STATUS[i].equals(status))
- setTextColor(COLOR_STATUS[i]);
- }
- }
-
- public void setTextColor(Color c) {
- textColor = c;
- }
-
- public Color getTextColor() {
- return textColor;
- }
-
- public Hashtable getParameters() {
- return parameters;
- }
-
- public String toString() {
- return displayName;
- }
+ public void setRef(String ref) {
+ refArea.setText(ref);
}
+
protected class PeerCellRenderer extends JLabel implements
ListCellRenderer {
public PeerCellRenderer() {