예제 #1
0
파일: TaskRuntime.cs 프로젝트: beysims/reef
        public void OnNext(IDriverMessage value)
        {
            IDriverMessageHandler messageHandler = null;

            LOGGER.Log(Level.Info, "TaskRuntime::OnNext(IDriverMessage value)");
            try
            {
                messageHandler = _injector.GetInstance <IDriverMessageHandler>();
            }
            catch (Exception e)
            {
                Org.Apache.Reef.Utilities.Diagnostics.Exceptions.CaughtAndThrow(e, Level.Error, "Received Driver message, but unable to inject handler for driver message ", LOGGER);
            }
            if (messageHandler != null)
            {
                try
                {
                    messageHandler.Handle(value);
                }
                catch (Exception e)
                {
                    Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Caught(e, Level.Warning, "Exception throw when handling driver message: " + e, LOGGER);
                    _currentStatus.RecordExecptionWithoutHeartbeat(e);
                }
            }
        }
예제 #2
0
        private TaskRuntime(
            ITask userTask,
            IDriverMessageHandler driverMessageHandler,
            IDriverConnectionMessageHandler driverConnectionMessageHandler,
            TaskStatus taskStatus,
            [Parameter(typeof(TaskConfigurationOptions.SuspendHandler))] IInjectionFuture <IObserver <ISuspendEvent> > suspendHandlerFuture)
        {
            _currentStatus        = taskStatus;
            _driverMessageHandler = Optional <IDriverMessageHandler> .Of(driverMessageHandler);

            _driverConnectionMessageHandler = Optional <IDriverConnectionMessageHandler> .Of(driverConnectionMessageHandler);

            _userTask             = userTask;
            _suspendHandlerFuture = suspendHandlerFuture;
        }