Exemplo n.º 1
0
        internal void adapterRequestException(AdapterRequest request, Exception ex)
        {
            lock (this)
            {
                AdapterRequest r;
                if (!_adapterRequests.TryGetValue(request.getId(), out r) || r != request)
                {
                    return;
                }

                if (request.exception())
                {
                    if (_warnOnce)
                    {
                        StringBuilder s = new StringBuilder();
                        s.Append("failed to lookup adapter `");
                        s.Append(request.getId());
                        s.Append("' with lookup proxy `");
                        s.Append(_lookup);
                        s.Append("':\n");
                        s.Append(ex.ToString());
                        _lookup.ice_getCommunicator().getLogger().warning(s.ToString());
                        _warnOnce = false;
                    }
                    _timer.cancel(request);
                    _adapterRequests.Remove(request.getId());
                }
            }
        }
Exemplo n.º 2
0
        internal void adapterRequestTimedOut(AdapterRequest request)
        {
            lock (this)
            {
                AdapterRequest r;
                if (!_adapterRequests.TryGetValue(request.getId(), out r) || r != request)
                {
                    return;
                }

                if (request.retry())
                {
                    try
                    {
                        request.invoke(_domainId, _lookups);
                        _timer.schedule(request, _timeout);
                        return;
                    }
                    catch (Ice.LocalException)
                    {
                    }
                }

                request.finished(null);
                _adapterRequests.Remove(request.getId());
                _timer.cancel(request);
            }
        }
Exemplo n.º 3
0
        internal Task <Ice.ObjectPrx> findAdapter(string adapterId)
        {
            lock (this)
            {
                AdapterRequest request;
                if (!_adapterRequests.TryGetValue(adapterId, out request))
                {
                    request = new AdapterRequest(this, adapterId, _retryCount);
                    _adapterRequests.Add(adapterId, request);
                }

                var task = new TaskCompletionSource <Ice.ObjectPrx>();
                if (request.addCallback(task))
                {
                    try
                    {
                        request.invoke(_domainId, _lookups);
                        _timer.schedule(request, _timeout);
                    }
                    catch (Ice.LocalException)
                    {
                        request.finished(null);
                        _adapterRequests.Remove(adapterId);
                    }
                }
                return(task.Task);
            }
        }
Exemplo n.º 4
0
        internal void findAdapter(string adapterId, Action <Ice.ObjectPrx> response)
        {
            lock (this)
            {
                AdapterRequest request;
                if (!_adapterRequests.TryGetValue(adapterId, out request))
                {
                    request = new AdapterRequest(this, adapterId, _retryCount);
                    _adapterRequests.Add(adapterId, request);
                }

                if (request.addCallback(response))
                {
                    try
                    {
                        _lookup.findAdapterByIdAsync(_domainId, adapterId, _lookupReply);
                        _timer.schedule(request, _timeout);
                    }
                    catch (Ice.LocalException)
                    {
                        request.finished(null);
                        _adapterRequests.Remove(adapterId);
                    }
                }
            }
        }
Exemplo n.º 5
0
 internal void findAdapter(Ice.AMD_Locator_findAdapterById cb, string adapterId)
 {
     lock (this)
     {
         AdapterRequest request;
         if (!_adapterRequests.TryGetValue(adapterId, out request))
         {
             request = new AdapterRequest(this, adapterId, _retryCount);
             _adapterRequests.Add(adapterId, request);
         }
         if (request.addCallback(cb))
         {
             try
             {
                 _lookup.begin_findAdapterById(_domainId, adapterId, _lookupReply);
                 _timer.schedule(request, _timeout);
             }
             catch (Ice.LocalException)
             {
                 request.finished(null);
                 _adapterRequests.Remove(adapterId);
             }
         }
     }
 }
Exemplo n.º 6
0
        internal void adapterRequestTimedOut(AdapterRequest request)
        {
            lock (this)
            {
                AdapterRequest r;
                if (!_adapterRequests.TryGetValue(request.getId(), out r) || r != request)
                {
                    return;
                }

                if (request.retry())
                {
                    try
                    {
                        foreach (var l in _lookup)
                        {
                            l.Key.findAdapterByIdAsync(_domainId, request.getId(), l.Value);
                        }
                        _timer.schedule(request, _timeout);
                        return;
                    }
                    catch (Ice.LocalException)
                    {
                    }
                }

                request.finished(null);
                _adapterRequests.Remove(request.getId());
                _timer.cancel(request);
            }
        }