Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PoolHandler"/> class.
 /// </summary>
 /// <param name="queueManager">The queue manager.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="errorHandler">The error handler.</param>
 public PoolHandler(QueueManager queueManager, AsyncEventHandler handler, ErrorHandler errorHandler)
 {
     _queueManager = queueManager;
     _executionEngine = new ThreadPoolQueueExecutionEngine(_queueManager.Configuration);
     _executionEngine.OnThreadUsageChanged +=
         (EventHandler)
         ((sender, args) => _queueManager.Counters.ThreadsInUse = (long) _executionEngine.ThreadsInUse);
     _handler = handler;
     _errorHandler = errorHandler;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeneralErrorHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 public GeneralErrorHandler(ErrorHandler nextHandler)
     : base(nextHandler)
 {
     this._errorTable = new System.Collections.Generic.Dictionary<System.Type, ErrorAction>
         {
             {typeof (InvalidPluginExecutionException), new ErrorAction(ErrorActionType.Fail, -2147220891)},
             {typeof (System.TimeoutException), new ErrorAction(ErrorActionType.Retry, -2147204345)},
             {typeof (CommunicationException), new ErrorAction(ErrorActionType.Retry, -2147204345)},
             {typeof (EndpointNotFoundException), new ErrorAction(ErrorActionType.Retry, -2147204345)}
         };
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueManager"/> class.
 /// </summary>
 /// <param name="instanceName">Name of the instance.</param>
 /// <param name="operationsFactory">The operations factory.</param>
 /// <param name="counters">The counters.</param>
 /// <param name="config">The configuration.</param>
 /// <param name="dataAccessFactory">The data access factory.</param>
 /// <param name="errorHandler">The error handler.</param>
 /// <param name="eventLog">The event log.</param>
 public QueueManager(string instanceName, IServiceOperationsFactory operationsFactory, IQueuePerformanceCounters counters, IQueueConfiguration config, IQueueDataAccessFactory dataAccessFactory,
     ErrorHandler errorHandler, IMyEventLog eventLog)
 {
     _handler = null;
     _timers = new TimerBasedExecutionEngine[0];
     _specialTransitionsLock = new object();
     _specialTransitions = new Dictionary<Guid, AsyncHandlerEarlyExitRequest>();
     InstanceName = DecorateInstanceName(instanceName);
     Counters = counters;
     Configuration = config;
     ShuttingDown = false;
     _shutdownEvent = null;
     _disposed = false;
     _dataAccessFactory = dataAccessFactory;
     _errorHandler = errorHandler;
     EventLog = eventLog;
     OperationsFactory = operationsFactory;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MyErrorHandler"/> class.
 /// </summary>
 /// <param name="defaultActionType">Default type of the action.</param>
 /// <param name="nextHandler">The next handler.</param>
 public MyErrorHandler(ErrorActionType defaultActionType, ErrorHandler nextHandler)
     : base(nextHandler)
 {
     this._defaultActionType = defaultActionType;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes the components.
 /// </summary>
 private void InitializeComponents()
 {
     try
     {
         this._errorHandler = ErrorHandlerFactory.CreateDefault();
         this.InitializeQueueManager(Configuration);
         MyTrace.Write(TraceCategory.AsyncService, TraceLevel.Info, "异步服务已经准备好处理异步事件。");
         //SandboxHostManager.Initialize();
     }
     catch (System.Exception ex)
     {
         MyTrace.Write(TraceCategory.AsyncService, TraceLevel.Error,
                       "异步服务初始化组件时遭遇异常: {0} - {1}", ServiceName,
                       ex);
         throw;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebErrorHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 public WebErrorHandler(ErrorHandler nextHandler)
     : base(nextHandler)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TargetInvocationErrorHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 public TargetInvocationErrorHandler(ErrorHandler nextHandler)
     : base(nextHandler)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InvalidPluginExecutionExceptionHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 public InvalidPluginExecutionExceptionHandler(ErrorHandler nextHandler)
     : base(nextHandler)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 protected ErrorHandler(ErrorHandler nextHandler)
 {
     this._nextHandler = nextHandler;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlErrorHandler"/> class.
 /// </summary>
 /// <param name="nextHandler">The next handler.</param>
 public SqlErrorHandler(ErrorHandler nextHandler)
     : base(nextHandler)
 {
 }