Beispiel #1
0
            addCallback(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
            {
                RequestCallback callback = new RequestCallback(@ref, ttl, cb);

                lock (this)
                {
                    if (!_response && _exception == null)
                    {
                        _callbacks.Add(callback);
                        if (wellKnownRef != null)
                        {
                            // This request is to resolve the endpoints of a cached well-known object ref
                            _wellKnownRefs.Add(wellKnownRef);
                        }
                        if (!_sent)
                        {
                            _sent = true;
                            send();
                        }
                        return;
                    }
                }

                if (_response)
                {
                    callback.response(_locatorInfo, _proxy);
                }
                else
                {
                    Debug.Assert(_exception != null);
                    callback.exception(_locatorInfo, _exception);
                }
            }
Beispiel #2
0
 addCallback(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
 {
     _m.Lock();
     try
     {
         RequestCallback callback = new RequestCallback(@ref, ttl, cb);
         if (_response)
         {
             callback.response(_locatorInfo, _proxy);
         }
         else if (_exception != null)
         {
             callback.exception(_locatorInfo, _exception);
         }
         else
         {
             _callbacks.Add(callback);
             if (wellKnownRef != null)
             {
                 // This request is to resolve the endpoints of a cached well-known object ref
                 _wellKnownRefs.Add(wellKnownRef);
             }
             if (!_sent)
             {
                 _sent = true;
                 send(true);
             }
         }
     }
     finally
     {
         _m.Unlock();
     }
 }
Beispiel #3
0
        getEndpoints(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback callback)
        {
            Debug.Assert(@ref.isIndirect());
            EndpointI[] endpoints = null;
            bool        cached    = false;

            if ([email protected]())
            {
                endpoints = _table.getAdapterEndpoints(@ref.getAdapterId(), ttl, out cached);
                if (!cached)
                {
                    if (_background && endpoints != null)
                    {
                        getAdapterRequest(@ref).addCallback(@ref, wellKnownRef, ttl, null);
                    }
                    else
                    {
                        getAdapterRequest(@ref).addCallback(@ref, wellKnownRef, ttl, callback);
                        return;
                    }
                }
            }
            else
            {
                Reference r = _table.getObjectReference(@ref.getIdentity(), ttl, out cached);
                if (!cached)
                {
                    if (_background && r != null)
                    {
                        getObjectRequest(@ref).addCallback(@ref, null, ttl, null);
                    }
                    else
                    {
                        getObjectRequest(@ref).addCallback(@ref, null, ttl, callback);
                        return;
                    }
                }

                if (!r.isIndirect())
                {
                    endpoints = r.getEndpoints();
                }
                else if (!r.isWellKnown())
                {
                    getEndpoints(r, @ref, ttl, callback);
                    return;
                }
            }

            Debug.Assert(endpoints != null);
            if (@ref.getInstance().traceLevels().location >= 1)
            {
                getEndpointsTrace(@ref, endpoints, true);
            }
            if (callback != null)
            {
                callback.setEndpoints(endpoints, true);
            }
        }
Beispiel #4
0
 RequestCallback(Reference @ref, int ttl, GetEndpointsCallback cb)
 {
     _ref      = @ref;
     _ttl      = ttl;
     _callback = cb;
 }
Beispiel #5
0
 getEndpoints(Reference @ref, int ttl, GetEndpointsCallback callback)
 {
     getEndpoints(@ref, null, ttl, callback);
 }
Beispiel #6
0
 addCallback(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
 {
     _m.Lock();
     try
     {
         RequestCallback callback = new RequestCallback(@ref, ttl, cb);
         if(_response)
         {
             callback.response(_locatorInfo, _proxy);
         }
         else if(_exception != null)
         {
             callback.exception(_locatorInfo, _exception);
         }
         else
         {
             _callbacks.Add(callback);
             if(wellKnownRef != null) 
             {
                 // This request is to resolve the endpoints of a cached well-known object ref
                 _wellKnownRefs.Add(wellKnownRef);
             }
             if(!_sent)
             {
                 _sent = true;
                 send(true);
             }
         }
     }
     finally
     {
         _m.Unlock();
     }
 }
Beispiel #7
0
 RequestCallback(Reference @ref, int ttl, GetEndpointsCallback cb)
 {
     _ref = @ref;
     _ttl = ttl;
     _callback = cb;
 }
Beispiel #8
0
 getEndpoints(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback callback)
 {
     Debug.Assert(@ref.isIndirect());
     EndpointI[] endpoints = null;
     bool cached = false;
     if([email protected]())
     {
         endpoints = _table.getAdapterEndpoints(@ref.getAdapterId(), ttl, out cached);
         if(!cached)
         {
             if(_background && endpoints != null)
             {
                 getAdapterRequest(@ref).addCallback(@ref, wellKnownRef, ttl, null);
             }
             else
             {
                 getAdapterRequest(@ref).addCallback(@ref, wellKnownRef, ttl, callback);
                 return;
             }
         }
     }
     else
     {
         Reference r = _table.getObjectReference(@ref.getIdentity(), ttl, out cached);
         if(!cached)
         {
             if(_background && r != null)
             {
                 getObjectRequest(@ref).addCallback(@ref, null, ttl, null);
             }
             else
             {
                 getObjectRequest(@ref).addCallback(@ref, null, ttl, callback);
                 return;
             }
         }
         
         if(!r.isIndirect())
         {
             endpoints = r.getEndpoints();
         }
         else if(!r.isWellKnown())
         {
             getEndpoints(r, @ref, ttl, callback);
             return;
         }
     }
     
     Debug.Assert(endpoints != null);
     if(@ref.getInstance().traceLevels().location >= 1)
     {
         getEndpointsTrace(@ref, endpoints, true);
     }
     if(callback != null)
     {
         callback.setEndpoints(endpoints, true);
     }
 }
Beispiel #9
0
 getEndpoints(Reference @ref, int ttl, GetEndpointsCallback callback)
 {
     getEndpoints(@ref, null, ttl, callback);
 }
Beispiel #10
0
            public void addCallback(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
            {
                RequestCallback callback = new RequestCallback(@ref, ttl, cb);
                lock(this)
                {
                    if(!_response && _exception == null)
                    {
                        _callbacks.Add(callback);
                        if(wellKnownRef != null)
                        {
                            // This request is to resolve the endpoints of a cached well-known object ref
                            _wellKnownRefs.Add(wellKnownRef);
                        }
                        if(!_sent)
                        {
                            _sent = true;
                            send();
                        }
                        return;
                    }
                }

                if(_response)
                {
                    callback.response(_locatorInfo, _proxy);
                }
                else
                {
                    Debug.Assert(_exception != null);
                    callback.exception(_locatorInfo, _exception);
                }
            }
Beispiel #11
0
        getEndpoints(Reference reference, Reference wellKnownRef, int ttl, GetEndpointsCallback callback)
        {
            Debug.Assert(reference.isIndirect());
            EndpointI[] endpoints = null;
            bool        cached    = false;

            if (!reference.isWellKnown())
            {
                endpoints = _table.getAdapterEndpoints(reference.getAdapterId(), ttl, out cached);
                if (!cached)
                {
                    if (_background && endpoints != null)
                    {
                        getAdapterRequest(reference).addCallback(reference, wellKnownRef, ttl, null);
                    }
                    else
                    {
                        getAdapterRequest(reference).addCallback(reference, wellKnownRef, ttl, callback);
                        return;
                    }
                }
            }
            else
            {
                Reference r = _table.getObjectReference(reference.getIdentity(), ttl, out cached);
                if (!cached)
                {
                    if (_background && r != null)
                    {
                        getObjectRequest(reference).addCallback(reference, null, ttl, null);
                    }
                    else
                    {
                        getObjectRequest(reference).addCallback(reference, null, ttl, callback);
                        return;
                    }
                }

                if (!r.isIndirect())
                {
                    endpoints = r.getEndpoints();
                }
                else if (!r.isWellKnown())
                {
                    if (reference.getCommunicator().traceLevels().location >= 1)
                    {
                        trace("found adapter for well-known object in locator cache", reference, r);
                    }
                    getEndpoints(r, reference, ttl, callback);
                    return;
                }
            }

            Debug.Assert(endpoints != null);
            if (reference.getCommunicator().traceLevels().location >= 1)
            {
                getEndpointsTrace(reference, endpoints, true);
            }
            if (callback != null)
            {
                callback.setEndpoints(endpoints, true);
            }
        }
Beispiel #12
0
 getEndpoints(Reference reference, int ttl, GetEndpointsCallback callback)
 {
     getEndpoints(reference, null, ttl, callback);
 }