Exemplo n.º 1
0
        // Token: 0x06000B70 RID: 2928 RVA: 0x0002EC1C File Offset: 0x0002CE1C
        internal void QueueQueryItem(TokenRenewQueryContext queryContext)
        {
            GetTokens getTokens = null;

            lock (this.queryQueueLockObject)
            {
                if (this.queryQueue.Count > 500)
                {
                    TokenRenewSubmitter.Tracer.TraceError <IExchangePrincipal>(0L, "Query for {0} not added to the query queue because queue is full.", queryContext.ExchangePrincipal);
                    ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ExtensionTokenQueryMaxExceeded, null, new object[]
                    {
                        "ProcessTokenRenew",
                        ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal)
                    });
                    return;
                }
                TokenRenewSubmitter.Tracer.TraceDebug <IExchangePrincipal>(0L, "Adding query for {0} to the query queue.", queryContext.ExchangePrincipal);
                this.queryQueue.Enqueue(queryContext);
                if (this.GetTokensCount < 50)
                {
                    getTokens = new GetTokens(this.urlsCache, this);
                    this.GetTokensCount++;
                    TokenRenewSubmitter.Tracer.TraceDebug <int>(0L, "Creating a new instance of GetTokens. GetTokens Count {0}", this.GetTokensCount);
                }
                else
                {
                    TokenRenewSubmitter.Tracer.TraceDebug <int>(0L, "Too many GetTokens commands. Query will be handled from pool. GetTokens Count {0}", this.GetTokensCount);
                }
            }
            if (getTokens != null)
            {
                this.ExecuteTokenRenewQuery(getTokens);
            }
        }
Exemplo n.º 2
0
        // Token: 0x06000B71 RID: 2929 RVA: 0x0002ED38 File Offset: 0x0002CF38
        internal void ExecuteTokenRenewQuery(GetTokens getTokens)
        {
            TokenRenewQueryContext tokenRenewQueryContext = null;

            lock (this.queryQueueLockObject)
            {
                if (this.queryQueue.Count > 0)
                {
                    tokenRenewQueryContext = this.queryQueue.Dequeue();
                }
                else
                {
                    this.GetTokensCount--;
                    if (this.GetTokensCount < 0)
                    {
                        throw new InvalidOperationException("GetTokensCount can't be less than 0.");
                    }
                    TokenRenewSubmitter.Tracer.TraceDebug <int>(0L, "Query queue is empty. GetTokens Count {0}", this.GetTokensCount);
                }
            }
            if (tokenRenewQueryContext != null)
            {
                TokenRenewSubmitter.Tracer.TraceDebug <IExchangePrincipal>(0L, "Starting query for {0}.", tokenRenewQueryContext.ExchangePrincipal);
                getTokens.Execute(tokenRenewQueryContext);
            }
        }
Exemplo n.º 3
0
        // Token: 0x06000B6F RID: 2927 RVA: 0x0002EB20 File Offset: 0x0002CD20
        internal void SubmitRenewQuery(ICollection <ExtensionData> extensions, TokenRenewQueryContext queryContext)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException("extensions");
            }
            if (extensions.Count == 0)
            {
                throw new ArgumentException("extensions must contain one or more extensions");
            }
            List <TokenRenewRequestAsset> list = new List <TokenRenewRequestAsset>(extensions.Count);

            foreach (ExtensionData extensionData in extensions)
            {
                list.Add(new TokenRenewRequestAsset
                {
                    MarketplaceContentMarket = extensionData.MarketplaceContentMarket,
                    ExtensionID        = extensionData.ExtensionId,
                    MarketplaceAssetID = extensionData.MarketplaceAssetID,
                    Scope  = extensionData.Scope.Value,
                    Etoken = extensionData.Etoken
                });
            }
            if (list.Count == 0)
            {
                TokenRenewSubmitter.Tracer.TraceDebug(0L, "ExtensionsCache.SubmitRenewQuery: TokenRenewRequestAssets count is 0. Token renew query will not be started.");
                return;
            }
            queryContext.TokenRenewRequestAssets = list;
            queryContext.DeploymentId            = ExtensionDataHelper.GetDeploymentId(queryContext.Domain);
            this.QueueQueryItem(queryContext);
        }
Exemplo n.º 4
0
 internal void Execute(TokenRenewQueryContext queryContext)
 {
     if (queryContext == null)
     {
         throw new ArgumentNullException("queryContext");
     }
     if (queryContext.TokenRenewRequestAssets == null)
     {
         throw new ArgumentNullException("QueryContext.TokenRenewRequestAssets");
     }
     if (queryContext.TokenRenewRequestAssets.Count == 0)
     {
         throw new ArgumentException("QueryContext.TokenRenewRequestAssets must include 1 or more extensions");
     }
     this.queryContext  = queryContext;
     this.downloadQueue = new Queue <TokenRenewRequestAsset>(queryContext.TokenRenewRequestAssets.Count);
     foreach (TokenRenewRequestAsset item in queryContext.TokenRenewRequestAssets)
     {
         this.downloadQueue.Enqueue(item);
     }
     this.downloadToken = new DownloadToken(this.urlsCache);
     this.ExecuteDownload(this.downloadToken);
 }