예제 #1
0
        internal override bool Initialize()
        {
            //
            // see if we already cached a DiscoveryServerType
            //
            if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type)) &&
                null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true)))
            {
                lock (InternalSyncObject) {
                    if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type)) &&
                        null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true)))
                    {
                        //
                        // if not create a new DiscoveryServerType and cache it
                        //
                        bool   excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(DiscoveryServerProtocol), Type);
                        string escapedUri = RuntimeUtils.EscapeUri(Request.Url);
                        serverType = new DiscoveryServerType(Type, escapedUri, excludeSchemeHostPortFromCachingKey);
                        AddToCache(typeof(DiscoveryServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            return(true);
        }
예제 #2
0
 internal override bool Initialize()
 {
     this.serverType = (DiscoveryServerType)base.GetFromCache(typeof(DiscoveryServerProtocol), base.Type);
     if (this.serverType == null)
     {
         lock (ServerProtocol.InternalSyncObject)
         {
             this.serverType = (DiscoveryServerType)base.GetFromCache(typeof(DiscoveryServerProtocol), base.Type);
             if (this.serverType == null)
             {
                 string uri = Uri.EscapeUriString(base.Request.Url.ToString()).Replace("#", "%23");
                 this.serverType = new DiscoveryServerType(base.Type, uri);
                 base.AddToCache(typeof(DiscoveryServerProtocol), base.Type, this.serverType);
             }
         }
     }
     return(true);
 }
 internal override bool Initialize()
 {
     this.serverType = (DiscoveryServerType) base.GetFromCache(typeof(DiscoveryServerProtocol), base.Type);
     if (this.serverType == null)
     {
         lock (ServerProtocol.InternalSyncObject)
         {
             this.serverType = (DiscoveryServerType) base.GetFromCache(typeof(DiscoveryServerProtocol), base.Type);
             if (this.serverType == null)
             {
                 string uri = Uri.EscapeUriString(base.Request.Url.ToString()).Replace("#", "%23");
                 this.serverType = new DiscoveryServerType(base.Type, uri);
                 base.AddToCache(typeof(DiscoveryServerProtocol), base.Type, this.serverType);
             }
         }
     }
     return true;
 }
예제 #4
0
        internal override bool Initialize()
        {
            //
            // see if we already cached a DiscoveryServerType
            //
            serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type);
            if (serverType == null)
            {
                lock (Type){
                    serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type);
                    if (serverType == null)
                    {
                        //
                        // if not create a new DiscoveryServerType and cache it
                        //
                        serverType = new DiscoveryServerType(Type, Request.Url.ToString());
                        AddToCache(typeof(DiscoveryServerProtocol), Type, serverType);
                    }
                }
            }

            return(true);
        }
        internal override bool Initialize() {
            //
            // see if we already cached a DiscoveryServerType
            //
            if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type))
                && null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true))) {
                lock (InternalSyncObject) {
                    if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type))
                        && null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true)))
                    {
                        //
                        // if not create a new DiscoveryServerType and cache it
                        //
                        bool excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(DiscoveryServerProtocol), Type);
                        string escapedUri = Uri.EscapeUriString(Request.Url.ToString()).Replace("#", "%23");
                        serverType = new DiscoveryServerType(Type, escapedUri, excludeSchemeHostPortFromCachingKey);
                        AddToCache(typeof(DiscoveryServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            return true;                       
        }