diff options
author | Bernard Normier <bernard@zeroc.com> | 2006-12-21 18:01:22 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2006-12-21 18:01:22 +0000 |
commit | 3c807be4d33a23a116ef935440bc7e5bd6a00a52 (patch) | |
tree | 2702fb19a321b9c1afda94be51a3fd31ce31928f /java/src | |
parent | New IceGridAdmin trace properties (diff) | |
download | ice-3c807be4d33a23a116ef935440bc7e5bd6a00a52.tar.bz2 ice-3c807be4d33a23a116ef935440bc7e5bd6a00a52.tar.xz ice-3c807be4d33a23a116ef935440bc7e5bd6a00a52.zip |
Fixed bugs #1640 and #1641
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceGridGUI/AdapterObserverI.java | 36 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/Root.java | 71 | ||||
-rw-r--r-- | java/src/IceGridGUI/ApplicationObserverI.java | 57 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Coordinator.java | 126 | ||||
-rwxr-xr-x | java/src/IceGridGUI/LiveDeployment/Node.java | 2 | ||||
-rwxr-xr-x | java/src/IceGridGUI/LiveDeployment/Root.java | 66 | ||||
-rwxr-xr-x | java/src/IceGridGUI/NodeObserverI.java | 48 | ||||
-rw-r--r-- | java/src/IceGridGUI/ObjectObserverI.java | 35 | ||||
-rwxr-xr-x | java/src/IceGridGUI/RegistryObserverI.java | 31 | ||||
-rw-r--r-- | java/src/IceInternal/PropertyNames.java | 4 |
10 files changed, 416 insertions, 60 deletions
diff --git a/java/src/IceGridGUI/AdapterObserverI.java b/java/src/IceGridGUI/AdapterObserverI.java index 85c429eea37..8a7a85cd3a4 100644 --- a/java/src/IceGridGUI/AdapterObserverI.java +++ b/java/src/IceGridGUI/AdapterObserverI.java @@ -13,14 +13,32 @@ import IceGrid.*; class AdapterObserverI extends _AdapterObserverDisp { - AdapterObserverI(Coordinator coordinator) { _coordinator = coordinator; + _trace = coordinator.traceObservers(); } public synchronized void adapterInit(final AdapterInfo[] adapters, Ice.Current current) { + if(_trace) + { + if(adapters.length == 0) + { + _coordinator.traceObserver("adapterInit (no adapter)"); + } + else + { + String names = ""; + for(int i = 0; i < adapters.length; ++i) + { + names += " " + adapters[i].id; + } + + _coordinator.traceObserver("adapterInit for adapters" + names); + } + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -32,6 +50,11 @@ class AdapterObserverI extends _AdapterObserverDisp public void adapterAdded(final AdapterInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("adapterAdded for adapter " + info.id); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -43,6 +66,11 @@ class AdapterObserverI extends _AdapterObserverDisp public void adapterUpdated(final AdapterInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("adapterUpdated for adapter " + info.id); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -54,6 +82,11 @@ class AdapterObserverI extends _AdapterObserverDisp public void adapterRemoved(final String id, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("adapterRemoved for adapter " + id); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -64,4 +97,5 @@ class AdapterObserverI extends _AdapterObserverDisp } private final Coordinator _coordinator; + private final boolean _trace; }; diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java index 2522e75b4cc..d7ac93fd9e8 100755 --- a/java/src/IceGridGUI/Application/Root.java +++ b/java/src/IceGridGUI/Application/Root.java @@ -36,6 +36,8 @@ public class Root extends ListTreeNode { super(false, null, desc.name); _coordinator = coordinator; + _traceSaveToRegistry = coordinator.traceSaveToRegistry(); + _descriptor = desc; _file = file; @@ -52,6 +54,7 @@ public class Root extends ListTreeNode { super(true, null, desc.name); _coordinator = coordinator; + _traceSaveToRegistry = coordinator.traceSaveToRegistry(); _descriptor = desc; _file = null; @@ -422,6 +425,11 @@ public class Root extends ListTreeNode { public void ice_response() { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": success"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -435,6 +443,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.UserException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -449,6 +462,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.LocalException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -462,6 +480,11 @@ public class Root extends ListTreeNode }; + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("sending updateApplication for application " + _id); + } + _coordinator.getAdmin().updateApplication_async(cb, updateDescriptor); asyncRelease = true; @@ -495,6 +518,11 @@ public class Root extends ListTreeNode { public void ice_response() { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": success"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -510,6 +538,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.UserException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -523,6 +556,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.LocalException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -535,6 +573,11 @@ public class Root extends ListTreeNode }; + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("sending addApplication for application " + _id); + } + _coordinator.getAdmin().addApplication_async(cb, _descriptor); asyncRelease = true; } @@ -547,6 +590,11 @@ public class Root extends ListTreeNode { public void ice_response() { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -582,6 +630,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.UserException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -600,6 +653,11 @@ public class Root extends ListTreeNode public void ice_exception(final Ice.LocalException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -617,6 +675,11 @@ public class Root extends ListTreeNode }; + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("sending syncApplication for application " + _id); + } + _coordinator.getAdmin().syncApplication_async(cb, _descriptor); asyncRelease = true; if(_live) @@ -634,6 +697,11 @@ public class Root extends ListTreeNode } catch(Ice.LocalException e) { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("Ice communications exception while saving application " + _id); + } + JOptionPane.showMessageDialog( _coordinator.getMainFrame(), e.toString(), @@ -1367,7 +1435,8 @@ public class Root extends ListTreeNode } } - private Coordinator _coordinator; + private final Coordinator _coordinator; + private final boolean _traceSaveToRegistry; // // 'this' is the root of the tree diff --git a/java/src/IceGridGUI/ApplicationObserverI.java b/java/src/IceGridGUI/ApplicationObserverI.java index a7dbe9ff443..66ab1655fb8 100644 --- a/java/src/IceGridGUI/ApplicationObserverI.java +++ b/java/src/IceGridGUI/ApplicationObserverI.java @@ -18,6 +18,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp { _instanceName = instanceName; _coordinator = coordinator; + _trace = coordinator.traceObservers(); } // @@ -53,15 +54,33 @@ class ApplicationObserverI extends _ApplicationObserverDisp public synchronized void applicationInit(int serial, java.util.List applications, Ice.Current current) { + if(_trace) + { + if(applications.size() == 0) + { + _coordinator.traceObserver("applicationInit (no application);" + + "serial is " + serial); + } + else + { + String names = ""; + java.util.Iterator p = applications.iterator(); + while(p.hasNext()) + { + names += " " + ((ApplicationInfo)p.next()).descriptor.name; + } + + _coordinator.traceObserver("applicationInit for application" + + (applications.size() == 1 ? "" : "s") + + names + + "; serial is " + serial); + } + } + _initialized = true; _serial = serial; - _applications = new java.util.LinkedList(); - java.util.Iterator p = applications.iterator(); - while(p.hasNext()) - { - _applications.add(((ApplicationInfo)p.next()).descriptor); // TODO: XXX: Use ApplicationInfo directly. - } + _applications = applications; notify(); } @@ -69,11 +88,18 @@ class ApplicationObserverI extends _ApplicationObserverDisp public void applicationAdded(final int serial, final ApplicationInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("applicationAdded for application " + + info.descriptor.name + + "; serial is " + serial); + } + SwingUtilities.invokeLater(new Runnable() { public void run() { - _coordinator.applicationAdded(serial, info.descriptor); // TODO: XXX: Use ApplicationInfo directly. + _coordinator.applicationAdded(serial, info); } }); } @@ -81,6 +107,13 @@ class ApplicationObserverI extends _ApplicationObserverDisp public void applicationRemoved(final int serial, final String name, final Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("applicationRemoved for application " + + name + + "; serial is " + serial); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -93,16 +126,24 @@ class ApplicationObserverI extends _ApplicationObserverDisp public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("applicationUpdated for application " + + info.descriptor.name + + "; serial is " + serial); + } + SwingUtilities.invokeLater(new Runnable() { public void run() { - _coordinator.applicationUpdated(serial, info.descriptor); // TODO: XXX: Use ApplicationUpdateInfo + _coordinator.applicationUpdated(serial, info); } }); } private final Coordinator _coordinator; + private final boolean _trace; private boolean _initialized = false; diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java index 25a87290c1f..a2af736cdc0 100755 --- a/java/src/IceGridGUI/Coordinator.java +++ b/java/src/IceGridGUI/Coordinator.java @@ -569,10 +569,7 @@ public class Coordinator add(_substituteTool); } } - - // - // All Coordinator's methods run in the UI thread - // + public Ice.Communicator getCommunicator() { if(_communicator == null) @@ -716,11 +713,11 @@ public class Coordinator // } - void applicationAdded(int serial, ApplicationDescriptor desc) + void applicationAdded(int serial, ApplicationInfo info) { - _liveDeploymentRoot.applicationAdded(desc); + _liveDeploymentRoot.applicationAdded(info); _statusBar.setText( - "Last update: new application '" + desc.name + "'"); + "Last update: new application '" + info.descriptor.name + "'"); updateSerial(serial); } @@ -744,19 +741,19 @@ public class Coordinator updateSerial(serial); } - void applicationUpdated(int serial, ApplicationUpdateDescriptor desc) + void applicationUpdated(int serial, ApplicationUpdateInfo update) { - _liveDeploymentRoot.applicationUpdated(desc); + _liveDeploymentRoot.applicationUpdated(update); _liveDeploymentPane.refresh(); - _statusBar.setText("Last update: application '" + desc.name + "' was updated"); + _statusBar.setText("Last update: application '" + update.descriptor.name + "' was updated"); ApplicationPane app = - (ApplicationPane)_liveApplications.get(desc.name); + (ApplicationPane)_liveApplications.get(update.descriptor.name); if(app != null) { - if(app.getRoot().update(desc)) + if(app.getRoot().update(update.descriptor)) { app.refresh(); } @@ -878,6 +875,11 @@ public class Coordinator { public void ice_response() { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("removeApplication for application " + name + ": success"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -890,6 +892,11 @@ public class Coordinator public void ice_exception(final Ice.UserException e) { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("removeApplication for application " + name + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -903,6 +910,11 @@ public class Coordinator public void ice_exception(final Ice.LocalException e) { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("removeApplication for application " + name + ": failed"); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -914,12 +926,23 @@ public class Coordinator } }; + if(_traceSaveToRegistry) + { + traceSaveToRegistry("sending removeApplication for application " + name); + } + try { _sessionKeeper.getAdmin().removeApplication_async(cb, name); + asyncRelease = true; } catch(Ice.LocalException e) { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("Ice communications exception while removing application " + name); + } + JOptionPane.showMessageDialog( getMainFrame(), e.toString(), @@ -963,6 +986,11 @@ public class Coordinator try { _writeSerial = _sessionKeeper.getSession().startUpdate(); + + if(_traceSaveToRegistry) + { + traceSaveToRegistry("startUpdate returned serial " + _writeSerial); + } } finally { @@ -977,14 +1005,32 @@ public class Coordinator // _writeAccessCount++; + if(_traceSaveToRegistry) + { + traceSaveToRegistry("acquireExclusiveWriteAccess: writeAccessCount is " + _writeAccessCount); + } + if(runnable != null) { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("lastestSerial is " + _latestSerial); + } + if(_writeSerial <= _latestSerial) { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("run update immediately"); + } runnable.run(); } else { + if(_traceSaveToRegistry) + { + traceSaveToRegistry("wait for updates from ApplicationObserver"); + } _onExclusiveWrite = runnable; _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // @@ -1002,6 +1048,10 @@ public class Coordinator { _writeSerial = -1; _sessionKeeper.getSession().finishUpdate(); + if(_traceSaveToRegistry) + { + traceSaveToRegistry("finishUpdate done"); + } } catch(AccessDeniedException e) { @@ -1023,6 +1073,11 @@ public class Coordinator JOptionPane.ERROR_MESSAGE); } } + + if(_traceSaveToRegistry) + { + traceSaveToRegistry("releaseExclusiveWriteAccess: writeAccessCount is " + _writeAccessCount); + } } private void updateSerial(int serial) @@ -1036,12 +1091,16 @@ public class Coordinator { Runnable runnable = _onExclusiveWrite; _onExclusiveWrite = null; + + if(_traceSaveToRegistry) + { + traceSaveToRegistry("writeSerial <= latestSerial, running update"); + } runnable.run(); _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } - // // From the Registry observer: // @@ -1718,6 +1777,9 @@ public class Coordinator _initData.logger.warning(msg); } + _traceObservers = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.Observers") > 0; + _traceSaveToRegistry = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.SaveToRegistry") > 0; + _liveDeploymentRoot = new IceGridGUI.LiveDeployment.Root(this); _sessionKeeper = new SessionKeeper(this); @@ -2436,12 +2498,48 @@ public class Coordinator _signalMenu.setEnabled(false); _serverMenu.setEnabled(false); _serviceMenu.setEnabled(false); - } + } + + + public boolean traceObservers() + { + return _traceObservers; + } + + public void traceObserver(String message) + { + trace("Observers", message); + } + + public boolean traceSaveToRegistry() + { + return _traceSaveToRegistry; + } + + public void traceSaveToRegistry(String message) + { + trace("SaveToRegistry", message); + } + + // + // May run in any thread + // + private void trace(String category, String message) + { + // + // It would be nicer to use the communicator's logger, + // but accessing _communicator is not thread-safe. + // + _initData.logger.trace(category, message); + } private final Ice.InitializationData _initData; private Ice.Communicator _communicator; + private boolean _traceObservers; + private boolean _traceSaveToRegistry; + private Preferences _prefs; private StatusBarI _statusBar = new StatusBarI(); diff --git a/java/src/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/LiveDeployment/Node.java index 2ede821935c..9d3b2c08e1e 100755 --- a/java/src/IceGridGUI/LiveDeployment/Node.java +++ b/java/src/IceGridGUI/LiveDeployment/Node.java @@ -297,7 +297,7 @@ class Node extends ListTreeNode for(int index = 0; index < _children.size(); ++index) { - Server server = (Server)_children.get(i); + Server server = (Server)_children.get(index); if(server.getApplication().name.equals(appName)) { toRemove.add(server); diff --git a/java/src/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/LiveDeployment/Root.java index d545c96b5af..e85797e3801 100755 --- a/java/src/IceGridGUI/LiveDeployment/Root.java +++ b/java/src/IceGridGUI/LiveDeployment/Root.java @@ -178,7 +178,7 @@ public class Root extends ListArrayTreeNode java.util.Iterator p = applications.iterator(); while(p.hasNext()) { - applicationAdded((ApplicationDescriptor)p.next()); + applicationAdded((ApplicationInfo)p.next()); } } @@ -262,11 +262,11 @@ public class Root extends ListArrayTreeNode // // From the Registry Observer: // - public void applicationAdded(ApplicationDescriptor desc) + public void applicationAdded(ApplicationInfo info) { - _descriptorMap.put(desc.name, desc); + _descriptorMap.put(info.descriptor.name, info.descriptor); - java.util.Iterator p = desc.nodes.entrySet().iterator(); + java.util.Iterator p = info.descriptor.nodes.entrySet().iterator(); while(p.hasNext()) { java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); @@ -276,11 +276,11 @@ public class Root extends ListArrayTreeNode Node node = findNode(nodeName); if(node == null) { - insertNode(new Node(this, desc, nodeName, nodeDesc)); + insertNode(new Node(this, info.descriptor, nodeName, nodeDesc)); } else { - node.add(desc, nodeDesc); + node.add(info.descriptor, nodeDesc); } } } @@ -306,39 +306,39 @@ public class Root extends ListArrayTreeNode removeNodes(resize(toRemoveIndices, toRemove.size()), toRemove); } - public void applicationUpdated(ApplicationUpdateDescriptor update) + public void applicationUpdated(ApplicationUpdateInfo update) { - ApplicationDescriptor appDesc = (ApplicationDescriptor)_descriptorMap.get(update.name); + ApplicationDescriptor appDesc = (ApplicationDescriptor)_descriptorMap.get(update.descriptor.name); // // Update various fields of appDesc // - if(update.description != null) + if(update.descriptor.description != null) { - appDesc.description = update.description.value; + appDesc.description = update.descriptor.description.value; } - if(update.distrib != null) + if(update.descriptor.distrib != null) { - appDesc.distrib = update.distrib.value; + appDesc.distrib = update.descriptor.distrib.value; } - appDesc.variables.keySet().removeAll(java.util.Arrays.asList(update.removeVariables)); - appDesc.variables.putAll(update.variables); - boolean variablesChanged = update.removeVariables.length > 0 || !update.variables.isEmpty(); + appDesc.variables.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeVariables)); + appDesc.variables.putAll(update.descriptor.variables); + boolean variablesChanged = update.descriptor.removeVariables.length > 0 || !update.descriptor.variables.isEmpty(); // // Update only descriptors (no tree node shown in this view) // appDesc.propertySets.keySet(). - removeAll(java.util.Arrays.asList(update.removePropertySets)); - appDesc.propertySets.putAll(update.propertySets); + removeAll(java.util.Arrays.asList(update.descriptor.removePropertySets)); + appDesc.propertySets.putAll(update.descriptor.propertySets); - for(int i = 0; i < update.removeReplicaGroups.length; ++i) + for(int i = 0; i < update.descriptor.removeReplicaGroups.length; ++i) { for(int j = 0; j < appDesc.replicaGroups.size(); ++j) { ReplicaGroupDescriptor rgd = (ReplicaGroupDescriptor)appDesc.replicaGroups.get(j); - if(rgd.id.equals(update.removeReplicaGroups[i])) + if(rgd.id.equals(update.descriptor.removeReplicaGroups[i])) { appDesc.replicaGroups.remove(j); break; // for @@ -346,9 +346,9 @@ public class Root extends ListArrayTreeNode } } - for(int i = 0; i < update.replicaGroups.size(); ++i) + for(int i = 0; i < update.descriptor.replicaGroups.size(); ++i) { - ReplicaGroupDescriptor newRgd = (ReplicaGroupDescriptor)update.replicaGroups.get(i); + ReplicaGroupDescriptor newRgd = (ReplicaGroupDescriptor)update.descriptor.replicaGroups.get(i); boolean replaced = false; int j = 0; @@ -371,12 +371,12 @@ public class Root extends ListArrayTreeNode } appDesc.serviceTemplates.keySet(). - removeAll(java.util.Arrays.asList(update.removeServiceTemplates)); - appDesc.serviceTemplates.putAll(update.serviceTemplates); + removeAll(java.util.Arrays.asList(update.descriptor.removeServiceTemplates)); + appDesc.serviceTemplates.putAll(update.descriptor.serviceTemplates); appDesc.serverTemplates.keySet(). - removeAll(java.util.Arrays.asList(update.removeServerTemplates)); - appDesc.serverTemplates.putAll(update.serverTemplates); + removeAll(java.util.Arrays.asList(update.descriptor.removeServerTemplates)); + appDesc.serverTemplates.putAll(update.descriptor.serverTemplates); // // Nodes @@ -385,12 +385,12 @@ public class Root extends ListArrayTreeNode // // Removal // - appDesc.nodes.keySet().removeAll(java.util.Arrays.asList(update.removeNodes)); + appDesc.nodes.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeNodes)); - for(int i = 0; i < update.removeNodes.length; ++i) + for(int i = 0; i < update.descriptor.removeNodes.length; ++i) { - Node node = findNode(update.removeNodes[i]); - if(node.remove(update.name)) + Node node = findNode(update.descriptor.removeNodes[i]); + if(node.remove(update.descriptor.name)) { int index = getIndex(node); _nodes.remove(node); @@ -401,7 +401,7 @@ public class Root extends ListArrayTreeNode // // Add/update // - java.util.Iterator p = update.nodes.iterator(); + java.util.Iterator p = update.descriptor.nodes.iterator(); java.util.Set freshNodes = new java.util.HashSet(); while(p.hasNext()) { @@ -418,7 +418,7 @@ public class Root extends ListArrayTreeNode else { node.update(appDesc, nodeUpdateDesc, variablesChanged, - update.serviceTemplates.keySet(), update.serverTemplates.keySet()); + update.descriptor.serviceTemplates.keySet(), update.descriptor.serverTemplates.keySet()); } freshNodes.add(node); } @@ -426,7 +426,7 @@ public class Root extends ListArrayTreeNode // // Notify non-fresh nodes if needed // - if(variablesChanged || !update.serviceTemplates.isEmpty() || !update.serverTemplates.isEmpty()) + if(variablesChanged || !update.descriptor.serviceTemplates.isEmpty() || !update.descriptor.serverTemplates.isEmpty()) { p = _nodes.iterator(); while(p.hasNext()) @@ -435,7 +435,7 @@ public class Root extends ListArrayTreeNode if(!freshNodes.contains(node)) { node.update(appDesc, null, variablesChanged, - update.serviceTemplates.keySet(), update.serverTemplates.keySet()); + update.descriptor.serviceTemplates.keySet(), update.descriptor.serverTemplates.keySet()); } } } diff --git a/java/src/IceGridGUI/NodeObserverI.java b/java/src/IceGridGUI/NodeObserverI.java index f5d389c492e..fb00b5e0615 100755 --- a/java/src/IceGridGUI/NodeObserverI.java +++ b/java/src/IceGridGUI/NodeObserverI.java @@ -16,10 +16,30 @@ class NodeObserverI extends _NodeObserverDisp NodeObserverI(Coordinator coordinator) { _coordinator = coordinator; + _trace = _coordinator.traceObservers(); } public void nodeInit(final NodeDynamicInfo[] nodes, Ice.Current current) { + if(_trace) + { + if(nodes.length == 0) + { + _coordinator.traceObserver("nodeInit (no node)"); + } + else + { + String names = ""; + for(int i = 0; i < nodes.length; ++i) + { + names += " " + nodes[i].info.name; + } + _coordinator.traceObserver("nodeInit for node" + + (nodes.length == 1 ? "" : "s") + + names); + } + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -34,6 +54,11 @@ class NodeObserverI extends _NodeObserverDisp public void nodeUp(final NodeDynamicInfo nodeInfo, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("nodeUp for node " + nodeInfo.info.name); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -45,6 +70,11 @@ class NodeObserverI extends _NodeObserverDisp public void nodeDown(final String nodeName, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("nodeUp for node " + nodeName); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -57,6 +87,13 @@ class NodeObserverI extends _NodeObserverDisp public void updateServer(final String node, final ServerDynamicInfo updatedInfo, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("updateServer for server " + updatedInfo.id + + " on node " + node + "; new state is " + + updatedInfo.state.toString()); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -69,6 +106,14 @@ class NodeObserverI extends _NodeObserverDisp public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("updateAdapter for adapter " + updatedInfo.id + + " on node " + node + "; new proxy is " + + (updatedInfo.proxy == null ? "null" + : updatedInfo.proxy.toString())); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -78,5 +123,6 @@ class NodeObserverI extends _NodeObserverDisp }); } - private Coordinator _coordinator; + private final Coordinator _coordinator; + private final boolean _trace; }; diff --git a/java/src/IceGridGUI/ObjectObserverI.java b/java/src/IceGridGUI/ObjectObserverI.java index 84a6bddf08a..f86aca9a260 100644 --- a/java/src/IceGridGUI/ObjectObserverI.java +++ b/java/src/IceGridGUI/ObjectObserverI.java @@ -17,10 +17,29 @@ class ObjectObserverI extends _ObjectObserverDisp ObjectObserverI(Coordinator coordinator) { _coordinator = coordinator; + _trace = coordinator.traceObservers(); } public synchronized void objectInit(final ObjectInfo[] objects, Ice.Current current) { + if(_trace) + { + if(objects.length == 0) + { + _coordinator.traceObserver("objectInit (no object)"); + } + else + { + String names = ""; + for(int i = 0; i < objects.length; ++i) + { + names += " " + objects[i].proxy.toString(); + } + + _coordinator.traceObserver("objectInit for objects" + names); + } + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -32,6 +51,11 @@ class ObjectObserverI extends _ObjectObserverDisp public void objectAdded(final ObjectInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("objectAdded for object " + info.proxy.toString()); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -43,6 +67,11 @@ class ObjectObserverI extends _ObjectObserverDisp public void objectUpdated(final ObjectInfo info, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("objectUpdated for object " + info.proxy.toString()); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -54,6 +83,11 @@ class ObjectObserverI extends _ObjectObserverDisp public void objectRemoved(final Ice.Identity id, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("objectRemoved for object " + Ice.Util.identityToString(id)); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -64,4 +98,5 @@ class ObjectObserverI extends _ObjectObserverDisp } private final Coordinator _coordinator; + private final boolean _trace; }; diff --git a/java/src/IceGridGUI/RegistryObserverI.java b/java/src/IceGridGUI/RegistryObserverI.java index dd48ccbc9bd..704a2325deb 100755 --- a/java/src/IceGridGUI/RegistryObserverI.java +++ b/java/src/IceGridGUI/RegistryObserverI.java @@ -17,10 +17,30 @@ class RegistryObserverI extends _RegistryObserverDisp RegistryObserverI(Coordinator coordinator) { _coordinator = coordinator; + _trace = _coordinator.traceObservers(); } public void registryInit(final RegistryInfo[] registryInfos, Ice.Current current) { + if(_trace) + { + if(registryInfos.length == 0) + { + _coordinator.traceObserver("registryInit (no registry)"); + } + else + { + String names = ""; + for(int i = 0; i < registryInfos.length; ++i) + { + names += " " + registryInfos[i].name; + } + _coordinator.traceObserver("registryInit for registr" + + (registryInfos.length == 1 ? "y" : "ies") + + names); + } + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -35,6 +55,11 @@ class RegistryObserverI extends _RegistryObserverDisp public void registryUp(final RegistryInfo registryInfo, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("registryUp for registry " + registryInfo.name); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -46,6 +71,11 @@ class RegistryObserverI extends _RegistryObserverDisp public void registryDown(final String registryName, Ice.Current current) { + if(_trace) + { + _coordinator.traceObserver("registryDown for registry " + registryName); + } + SwingUtilities.invokeLater(new Runnable() { public void run() @@ -56,4 +86,5 @@ class RegistryObserverI extends _RegistryObserverDisp } private final Coordinator _coordinator; + private final boolean _trace; }; diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index 371067b3480..610f44ab4d7 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `./config/PropertyNames.def', Wed Dec 20 11:12:28 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Thu Dec 21 12:31:33 2006 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -132,6 +132,8 @@ public final class PropertyNames "^IceGridAdmin\\.Routed$", "^IceGridAdmin\\.Username$", "^IceGridAdmin\\.Password$", + "^IceGridAdmin\\.Trace\\.Observers$", + "^IceGridAdmin\\.Trace\\.SaveToRegistry$", null }; |