コード例 #1
0
ファイル: FailDriver.cs プロジェクト: wonook/reef
        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);
            }
        }
コード例 #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;
            }
        }
コード例 #3
0
            public void OnNext(IRunningTask value)
            {
                Logger.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "RunningTask: {0}, Context: {1}.", value.Id, value.ActiveContext.Id));
                if (value.Id.Equals(_failedTaskId))
                {
                    _failedContextId = value.ActiveContext.Id;
                }
                string msg = value.Id.Equals(_failedTaskId) ? FailSignal : SuccSignal;

                value.Send(Encoding.UTF8.GetBytes(msg));
            }
コード例 #4
0
ファイル: TestResubmitTask.cs プロジェクト: wonook/reef
            /// <summary>
            /// Close the first two tasks and send message to the 3rd and 4th tasks
            /// </summary>
            /// <param name="value"></param>
            public void OnNext(IRunningTask value)
            {
                Logger.Log(Level.Info, "Task running: " + value.Id);
                switch (value.Id)
                {
                case TaskId + "1":
                    value.Dispose(Encoding.UTF8.GetBytes(KillTaskCommandFromDriver));
                    break;

                case TaskId + "2":
                case TaskId + "3":
                    value.Send(Encoding.UTF8.GetBytes(CompleteTaskCommandFromDriver));
                    break;

                default:
                    throw new Exception("It should not be reached.");
                }
            }
コード例 #5
0
 public void OnNext(IRunningTask value)
 {
     value.Send(Encoding.UTF8.GetBytes(FailSignal));
 }
コード例 #6
0
 public void OnNext(IRunningTask runningTask)
 {
     LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "TaskMessegingRunningTaskHandler: {0} is to send message {1}.", runningTask.Id, Message));
     runningTask.Send(ByteUtilities.StringToByteArrays(Message));
 }
コード例 #7
0
 public void OnNext(IRunningTask runningTask)
 {
     Logger.Log(Level.Info, SendingMessageToTaskLog);
     runningTask.Send(ByteUtilities.StringToByteArrays(Message));
 }
コード例 #8
0
 public void OnNext(IRunningTask value)
 {
     value.Send(Encoding.UTF8.GetBytes("Hello from Driver!"));
 }