Exemplo n.º 1
0
        public void OnNext(Alarm time)
        {
            CheckMsgOrder(time);
            switch (_state)
            {
            case DriverState.SendMsg:
                Log.Log(Level.Info, "Send message to task {0}", _task.Id);
                _task.Send(HelloStringByteArray);
                break;

            case DriverState.Suspend:
                Log.Log(Level.Info, "Suspend task {0}", _task.Id);
                _task.Suspend();
                break;

            case DriverState.Close:
                Log.Log(Level.Info, "Close task {0}", _task.Id);
                _task.Dispose();
                break;

            default:
                Log.Log(Level.Warning, "Unexpected state at AlarmHandler: {0}", _state);
                throw new DriverSideFailure("Unexpected state: " + _state);
            }
        }
Exemplo n.º 2
0
        public void OnNext(IRunningTask task)
        {
            Log.Log(Level.Info,
                    "TaskRuntime: {0} expect {1}",
                    task.Id, _taskId);

            if (!_taskId.Equals(task.Id))
            {
                throw new DriverSideFailure($"Task ID {task.Id} not equal expected ID {_taskId}");
            }

            switch (_failTaskName)
            {
            case "FailTaskMsg":
                Log.Log(Level.Info, "TaskRuntime: Send message: {0}", task);
                task.Send(new byte[0]);
                break;

            case "FailTaskSuspend":
                Log.Log(Level.Info, "TaskRuntime: Suspend: {0}", task);
                task.Suspend();
                break;

            case "FailTaskStop":
            case "FailTaskClose":
                Log.Log(Level.Info, "TaskRuntime: Stop/Close: {0}", task);
                task.Dispose();
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
 public void OnNext(IRunningTask value)
 {
     if (value.Id == TaskId)
     {
         Logger.Log(Level.Info, TaskSuspensionMessage);
         value.Suspend();
     }
 }
Exemplo n.º 4
0
 public void OnNext(IRunningTask value)
 {
     if (_firstTask)
     {
         // Suspend the first instance of the Task.
         value.Suspend(Encoding.UTF8.GetBytes(SuspendMessageFromDriver));
     }
 }