diff options
author | Jose <jose@zeroc.com> | 2012-08-14 00:05:17 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-08-14 00:05:17 +0200 |
commit | b3a890faf5841289df3299bac6ada7120b324c16 (patch) | |
tree | eacdb167a4d1e6310bfd49827f90fb2ddf2c144a /java/src/IceBox/ServiceManagerI.java | |
parent | missing filter properties (diff) | |
download | ice-b3a890faf5841289df3299bac6ada7120b324c16.tar.bz2 ice-b3a890faf5841289df3299bac6ada7120b324c16.tar.xz ice-b3a890faf5841289df3299bac6ada7120b324c16.zip |
ICE-4809 - AMI metadata in Ice services internal definitions
Diffstat (limited to 'java/src/IceBox/ServiceManagerI.java')
-rw-r--r-- | java/src/IceBox/ServiceManagerI.java | 86 |
1 files changed, 25 insertions, 61 deletions
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java index c25ab642207..8811bb84932 100644 --- a/java/src/IceBox/ServiceManagerI.java +++ b/java/src/IceBox/ServiceManagerI.java @@ -22,6 +22,27 @@ public class ServiceManagerI extends _ServiceManagerDisp _logger = _communicator.getLogger(); _argv = args; _traceServiceObserver = _communicator.getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver"); + _observerCompletedCB = new Ice.Callback() + { + public void completed(Ice.AsyncResult result) + { + try + { + result.throwLocalException(); + } + catch(Ice.LocalException ex) + { + ServiceObserverPrx observer = ServiceObserverPrxHelper.uncheckedCast(result.getProxy()); + synchronized(ServiceManagerI.this) + { + if(_observers.remove(observer)) + { + observerRemoved(observer, ex); + } + } + } + } + }; } public java.util.Map<String, String> @@ -207,23 +228,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(activeServices.size() > 0) { - AMI_ServiceObserver_servicesStarted cb = new AMI_ServiceObserver_servicesStarted() - { - public void ice_response() - { - // ok, success - } - - public void ice_exception(Ice.LocalException ex) - { - // - // Drop this observer - // - removeObserver(observer, ex); - } - }; - - observer.servicesStarted_async(cb, activeServices.toArray(new String[0])); + observer.begin_servicesStarted(activeServices.toArray(new String[0]), _observerCompletedCB); } } @@ -794,23 +799,7 @@ public class ServiceManagerI extends _ServiceManagerDisp for(final ServiceObserverPrx observer: observers) { - AMI_ServiceObserver_servicesStarted cb = new AMI_ServiceObserver_servicesStarted() - { - public void ice_response() - { - // ok, success - } - - public void ice_exception(Ice.LocalException ex) - { - // - // Drop this observer - // - removeObserver(observer, ex); - } - }; - - observer.servicesStarted_async(cb, servicesArray); + observer.begin_servicesStarted(servicesArray, _observerCompletedCB); } } } @@ -824,36 +813,11 @@ public class ServiceManagerI extends _ServiceManagerDisp for(final ServiceObserverPrx observer: observers) { - AMI_ServiceObserver_servicesStopped cb = new AMI_ServiceObserver_servicesStopped() - { - public void ice_response() - { - // ok, success - } - - public void ice_exception(Ice.LocalException ex) - { - // - // Drop this observer - // - removeObserver(observer, ex); - } - }; - - observer.servicesStopped_async(cb, servicesArray); + observer.begin_servicesStopped(servicesArray, _observerCompletedCB); } } } - private synchronized void - removeObserver(ServiceObserverPrx observer, Ice.LocalException ex) - { - if(_observers.remove(observer)) - { - observerRemoved(observer, ex); - } - } - private void observerRemoved(ServiceObserverPrx observer, RuntimeException ex) { @@ -1004,7 +968,7 @@ public class ServiceManagerI extends _ServiceManagerDisp private String[] _argv; // Filtered server argument vector private java.util.List<ServiceInfo> _services = new java.util.LinkedList<ServiceInfo>(); private boolean _pendingStatusChanges = false; - + private Ice.Callback _observerCompletedCB; java.util.HashSet<ServiceObserverPrx> _observers = new java.util.HashSet<ServiceObserverPrx>(); int _traceServiceObserver = 0; } |