summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/LiveDeployment/MetricsView.java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-09-28 23:44:07 +0200
committerJose <jose@zeroc.com>2012-09-28 23:44:07 +0200
commit9fa149f8507463a7e92a313057d5614eeb00084b (patch)
treed630a4595907f7782e773a6af6daef2ce5d1030d /java/src/IceGridGUI/LiveDeployment/MetricsView.java
parentMerge branch 'mx' of ssh://dev.zeroc.com/home/git/ice into mx (diff)
downloadice-9fa149f8507463a7e92a313057d5614eeb00084b.tar.bz2
ice-9fa149f8507463a7e92a313057d5614eeb00084b.tar.xz
ice-9fa149f8507463a7e92a313057d5614eeb00084b.zip
Added support to display IceBox metrics
Diffstat (limited to 'java/src/IceGridGUI/LiveDeployment/MetricsView.java')
-rw-r--r--java/src/IceGridGUI/LiveDeployment/MetricsView.java183
1 files changed, 92 insertions, 91 deletions
diff --git a/java/src/IceGridGUI/LiveDeployment/MetricsView.java b/java/src/IceGridGUI/LiveDeployment/MetricsView.java
index 63de78c90e1..616abcfc9e5 100644
--- a/java/src/IceGridGUI/LiveDeployment/MetricsView.java
+++ b/java/src/IceGridGUI/LiveDeployment/MetricsView.java
@@ -29,7 +29,7 @@ class MetricsView extends TreeNode
{
public Editor getEditor()
{
- _editor.show(this);
+ _editor.show(this, _data, _timestamp);
return _editor;
}
@@ -51,144 +51,145 @@ class MetricsView extends TreeNode
return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
- MetricsView(TreeNode parent, String name)
+ MetricsView(TreeNode parent, String name, IceMX.MetricsAdminPrx admin)
{
super(parent, name);
_name = name;
+ _admin = admin;
+
if(_editor == null)
{
_editor = new MetricsViewEditor(getRoot());
}
fetchMetricsView();
}
-
- public String name()
- {
- return _name;
- }
- Ice.ObjectPrx getServerAdmin()
+ public void startRefreshThread()
{
- if(_parent instanceof Server)
+ if(_editor != null)
{
- return ((Server)_parent).getServerAdmin();
+ _editor.startRefreshThread();
}
- else
+ }
+
+ public void stopRefreshThread()
+ {
+ if(_editor != null)
{
- return null;
+ _editor.startRefreshThread();
}
}
+
+ public String name()
+ {
+ return _name;
+ }
- public java.util.Map<java.lang.String, IceMX.Metrics[]> data()
+ IceMX.MetricsAdminPrx getMetricsAdmin()
{
- return _data;
+ return _admin;
}
public void fetchMetricsFailures(String map, String id, IceMX.Callback_MetricsAdmin_getMetricsFailures cb)
{
- Ice.ObjectPrx admin = getServerAdmin();
- if(admin == null)
- {
- return;
- }
-
- try
- {
- IceMX.MetricsAdminPrx metricsAdmin =
- IceMX.MetricsAdminPrxHelper.uncheckedCast(admin.ice_facet("MetricsAdmin"));
- metricsAdmin.begin_getMetricsFailures(_name, map, id, cb);
- }
- catch(Ice.LocalException e)
+ IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
+ if(metricsAdmin != null)
{
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
+ try
+ {
+ metricsAdmin.begin_getMetricsFailures(_name, map, id, cb);
+ }
+ catch(Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
}
}
public void fetchMetricsView()
{
- Ice.ObjectPrx admin = getServerAdmin();
- if(admin == null)
+ IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
+ if(metricsAdmin != null)
{
- return;
- }
-
- IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView()
- {
- public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data,
- long timestamp)
+ IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView()
{
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data,
+ final long timestamp)
+ {
+ SwingUtilities.invokeLater(new Runnable()
{
- _data = data;
- if(_editor != null && _editor.currentView() == MetricsView.this)
+ public void run()
{
- _editor.show(MetricsView.this);
+ _data = data;
+ _timestamp = timestamp;
+ if(_editor != null && _editor.currentView() == MetricsView.this)
+ {
+ _editor.show(MetricsView.this, data, timestamp);
+ }
}
- }
- });
- }
+ });
+ }
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ public void exception(final Ice.LocalException e)
+ {
+ SwingUtilities.invokeLater(new Runnable()
{
- e.printStackTrace();
- if(e instanceof Ice.ObjectNotExistException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.FacetNotExistException)
+ public void run()
{
- // MetricsAdmin facet not present.
+ stopRefreshThread();
+ if(e instanceof Ice.ObjectNotExistException)
+ {
+ // Server is down.
+ }
+ else if(e instanceof Ice.FacetNotExistException)
+ {
+ // MetricsAdmin facet not present.
+ }
+ else
+ {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
}
- else
+ });
+ }
+
+ public void exception(final Ice.UserException e)
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
+ stopRefreshThread();
e.printStackTrace();
JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
+ "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
}
- }
- });
- }
-
- public void exception(final Ice.UserException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- }
- };
- try
- {
- IceMX.MetricsAdminPrx metricsAdmin =
- IceMX.MetricsAdminPrxHelper.uncheckedCast(admin.ice_facet("MetricsAdmin"));
- metricsAdmin.begin_getMetricsView(_name, cb);
- }
- catch(Ice.LocalException e)
- {
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
+ });
+ }
+ };
+ try
+ {
+ metricsAdmin.begin_getMetricsView(_name, cb);
+ }
+ catch(Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
}
}
private String _name;
+ private IceMX.MetricsAdminPrx _admin;
private String _toolTip;
private MetricsViewEditor _editor;
private java.util.Map<java.lang.String, IceMX.Metrics[]> _data;
-
+ private long _timestamp;
static private DefaultTreeCellRenderer _cellRenderer;
}