示例#1
0
        public void Add(Action operation)
        {
            if (_shuttingDown)
            {
                return;
            }
            // seems to be causing more problems that it solves
            // throw new FiberException("The fiber is no longer accepting actions");

            _executor.Execute(operation);
        }
 public void ProcessOperation()
 {
     lock (_locker)
     {
         while (OperationsToExecute.Any())
         {
             IOperation currentOperation;
             OperationsToExecute.TryDequeue(out currentOperation);
             if (currentOperation != null)
             {
                 try
                 {
                     LoggingService.LogInfo(currentOperation, String.Format(Resources.Executing_operation__id));
                     OperationExecutor.Execute(currentOperation);
                     LoggingService.LogInfo(currentOperation, String.Format(Resources.Operation_executed_without_errors));
                 }
                 catch (Exception ex)
                 {
                     LoggingService.LogException(ex, currentOperation, String.Format("Error during execution of operation"));
                 }
             }
         }
     }
 }
示例#3
0
        bool Execute()
        {
            if (!WaitForActions())
            {
                return(false);
            }

            IList <Action> operations = RemoveAll();

            if (operations == null)
            {
                return(false);
            }

            _executor.Execute(operations, remaining =>
            {
                lock (_lock)
                {
                    int i = 0;
                    foreach (Action action in remaining)
                    {
                        _operations.Insert(i++, action);
                    }
                }
            });

            lock (_lock)
            {
                if (_operations.Count == 0)
                {
                    Monitor.PulseAll(_lock);
                }
            }

            return(true);
        }
        private void TestWatcher()
        {
            var operation = TabController.ConfigurationService.GetOperation(TabController.Configuration, Watcher.WatcherData);

            OperationExecutor.Execute(operation);
        }