public override void addObserver(ServiceObserverPrx observer, Ice.Current current) { List<string> activeServices = new List<string>(); // // Null observers and duplicate registrations are ignored // _m.Lock(); try { if(observer != null) { try { _observers.Add(observer, true); } catch(ArgumentException) { return; } if(_traceServiceObserver >= 1) { _logger.trace("IceBox.ServiceObserver", "Added service observer " + _communicator.proxyToString(observer)); } foreach(ServiceInfo info in _services) { if(info.status == ServiceStatus.Started) { activeServices.Add(info.name); } } } } finally { _m.Unlock(); } if(activeServices.Count > 0) { observer.servicesStarted_async(new AMIServicesStartedCallback(this, observer), activeServices.ToArray()); } }
private void observerRemoved(ServiceObserverPrx observer, System.Exception ex) { if (_traceServiceObserver >= 1) { // // CommunicatorDestroyedException may occur during shutdown. The observer notification has // been sent, but the communicator was destroyed before the reply was received. We do not // log a message for this exception. // if (!(ex is CommunicatorDestroyedException)) { _logger.trace("IceBox.ServiceObserver", $"Removed service observer {observer}\nafter catching {ex}"); } } }
public override void addObserver(ServiceObserverPrx observer, Ice.Current current) { List <string> activeServices = new List <string>(); // // Null observers and duplicate registrations are ignored // _m.Lock(); try { if (observer != null) { try { _observers.Add(observer, true); } catch (ArgumentException) { return; } if (_traceServiceObserver >= 1) { _logger.trace("IceBox.ServiceObserver", "Added service observer " + _communicator.proxyToString(observer)); } foreach (ServiceInfo info in _services) { if (info.status == ServiceStatus.Started) { activeServices.Add(info.name); } } } } finally { _m.Unlock(); } if (activeServices.Count > 0) { observer.begin_servicesStarted(activeServices.ToArray(), this.observerCompleted, null); } }
private void observerRemoved(ServiceObserverPrx observer, Exception ex) { if (_traceServiceObserver >= 1) { // // CommunicatorDestroyedException may occur during shutdown. The observer notification has // been sent, but the communicator was destroyed before the reply was received. We do not // log a message for this exception. // if (!(ex is Ice.CommunicatorDestroyedException)) { _logger.trace("IceBox.ServiceObserver", "Removed service observer " + _communicator.proxyToString(observer) + "\nafter catching " + ex.ToString()); } } }
observerCompleted(ServiceObserverPrx observer, Task t) { try { t.Wait(); } catch (AggregateException ae) { lock (this) { if (_observers.Remove(observer)) { observerRemoved(observer, ae.InnerException); } } } }
observerCompleted(Ice.AsyncResult result) { try { result.throwLocalException(); } catch (Ice.LocalException ex) { lock (this) { ServiceObserverPrx observer = ServiceObserverPrxHelper.uncheckedCast(result.getProxy()); if (_observers.Remove(observer)) { observerRemoved(observer, ex); } } } }
public override void addObserver(ServiceObserverPrx observer, Ice.Current current) { List <string> activeServices = new List <string>(); // // Null observers and duplicate registrations are ignored // lock (this) { if (observer != null) { try { _observers.Add(observer, true); } catch (ArgumentException) { return; } if (_traceServiceObserver >= 1) { _logger.trace("IceBox.ServiceObserver", "Added service observer " + _communicator.proxyToString(observer)); } foreach (ServiceInfo info in _services) { if (info.status == ServiceStatus.Started) { activeServices.Add(info.name); } } } } if (activeServices.Count > 0) { observer.servicesStartedAsync(activeServices.ToArray()).ContinueWith((t) => observerCompleted(observer, t), TaskScheduler.Current); } }
public AMIServicesStartedCallback(ServiceManagerI serviceManager, ServiceObserverPrx observer) { _serviceManager = serviceManager; _observer = observer; }
private void removeObserver(ServiceObserverPrx observer, Ice.Exception ex) { _m.Lock(); try { if(_observers.Remove(observer)) { observerRemoved(observer, ex); } } finally { _m.Unlock(); } }
private void observerRemoved(ServiceObserverPrx observer, System.Exception ex) { if(_traceServiceObserver >= 1) { // // CommunicatorDestroyedException may occur during shutdown. The observer notification has // been sent, but the communicator was destroyed before the reply was received. We do not // log a message for this exception. // if(!(ex is Ice.CommunicatorDestroyedException)) { _logger.trace("IceBox.ServiceObserver", "Removed service observer " + _communicator.proxyToString(observer) + "\nafter catching " + ex.ToString()); } } }
private void observerCompleted(ServiceObserverPrx observer, Task t) { try { t.Wait(); } catch(AggregateException ae) { lock(this) { if(_observers.Remove(observer)) { observerRemoved(observer, ae.InnerException); } } } }