// Token: 0x06000E7A RID: 3706 RVA: 0x00057118 File Offset: 0x00055318
 private static void RunTimedOperation(Action operation, object debugInfo, IPublicFolderMailboxLoggerBase logger)
 {
     AssistantRunspaceProxy.RunTimedOperation <int>(delegate()
     {
         operation();
         return(0);
     }, debugInfo, logger);
 }
Esempio n. 2
0
 // Token: 0x06000E68 RID: 3688 RVA: 0x00056CBA File Offset: 0x00054EBA
 public IAssistantRunspaceProxy CreateRunspaceForDatacenterAdmin(OrganizationId organizationId)
 {
     if (this.assistantRunspaceProxy == null)
     {
         this.assistantRunspaceProxy = AssistantRunspaceProxy.CreateRunspaceForDatacenterAdmin(organizationId);
     }
     return(this.assistantRunspaceProxy);
 }
        // Token: 0x06000E76 RID: 3702 RVA: 0x00056FB0 File Offset: 0x000551B0
        private Collection <T> RunPSCommand <T>(PSCommand command, out Collection <ErrorRecord> errors, IPublicFolderMailboxLoggerBase logger)
        {
            errors = null;
            PowerShellProxy powerShellProxy = null;
            Collection <T>  result          = AssistantRunspaceProxy.RunTimedOperation <Collection <T> >(delegate()
            {
                powerShellProxy = new PowerShellProxy(this.runspaceProxy, command);
                return(powerShellProxy.Invoke <T>());
            }, AssistantRunspaceProxy.GetCommandString(command), logger);

            if (powerShellProxy.Failed)
            {
                errors = powerShellProxy.Errors;
            }
            return(result);
        }
        // Token: 0x06000E7B RID: 3707 RVA: 0x00057148 File Offset: 0x00055348
        private static T RunTimedOperation <T>(Func <T> operation, object debugInfo, IPublicFolderMailboxLoggerBase logger)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            T         result;

            try
            {
                result = operation();
            }
            finally
            {
                stopwatch.Stop();
                TimeSpan timeoutForSynchronousOperation = PublicFolderSplitConfig.Instance.TimeoutForSynchronousOperation;
                if (timeoutForSynchronousOperation < stopwatch.Elapsed)
                {
                    logger.LogEvent(LogEventType.Error, string.Format("SLOW Operation: took {0}s using '{1}' stack trace {2}", stopwatch.Elapsed.Seconds, debugInfo, AssistantRunspaceProxy.GetCurrentStackTrace()));
                }
                else
                {
                    logger.LogEvent(LogEventType.Verbose, string.Format("Operation: took {0} using '{1}'", stopwatch.Elapsed, debugInfo));
                }
            }
            return(result);
        }