public override void Execute(ScheduledJobContext context) { if (this._connection.IsConnected) { long readBytes = this._connection.ReadBytes; if (readBytes > this._connection._lastBytesRead) { this._connection._lastBytesRead = readBytes; } else { FluorineRtmpContext.Initialize(this._connection); if ((this._connection._lastPongReceived > 0) && ((this._connection._lastPingSent - this._connection._lastPongReceived) > FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpConnectionSettings.MaxInactivity)) { RtmpServerConnection.log.Debug("Keep alive job name " + this._connection._keepAliveJobName); (this._connection.Scope.GetService(typeof(ISchedulingService)) as ISchedulingService).RemoveScheduledJob(this._connection._keepAliveJobName); this._connection._keepAliveJobName = null; RtmpServerConnection.log.Warn(string.Format("Closing {0} due to too much inactivity ({0}).", this._connection, this._connection._lastPingSent - this._connection._lastPongReceived)); this._connection.OnInactive(); } else { this._connection.Ping(); } } } }
public override void Execute(ScheduledJobContext context) { lock (_serverStream.SyncRoot) { if (_serverStream._liveJobName == null) return; _serverStream._liveJobName = null; _serverStream.OnItemEnd(); } }
public void ProcessJob(object state) { TriggerFiredBundle bundle = state as TriggerFiredBundle; Trigger trigger = bundle.Trigger; IScheduledJob job = bundle.Job; while (true) { JobExecutionException result = null; ScheduledJobContext context = new ScheduledJobContext(); try { job.Execute(context); } catch (JobExecutionException exception2) { result = exception2; log.Info(string.Format(CultureInfo.InvariantCulture, "Job {0} threw a JobExecutionException: ", new object[] { job.Name }), exception2); } catch (Exception exception3) { log.Error(string.Format(CultureInfo.InvariantCulture, "Job {0} threw an unhandled Exception: ", new object[] { job.Name }), exception3); SchedulerException cause = new SchedulerException("Job threw an unhandled exception.", exception3) { ErrorCode = 800 }; result = new JobExecutionException(cause, false) { ErrorCode = 800 }; } SchedulerInstruction noInstruction = SchedulerInstruction.NoInstruction; try { noInstruction = trigger.ExecutionComplete(context, result); } catch (Exception) { } if (noInstruction == SchedulerInstruction.ReExecuteJob) { if (log.get_IsDebugEnabled()) { log.Debug("Rescheduling trigger to reexecute"); } } else { this.TriggeredJobComplete(trigger, job, noInstruction); break; } } this.NotifySchedulerThread(); }
public void ProcessJob(object state) { TriggerFiredBundle bundle = state as TriggerFiredBundle; Trigger trigger = bundle.Trigger; IScheduledJob job = bundle.Job; do { JobExecutionException jobExecutionException = null; ScheduledJobContext scheduledJobContext = new ScheduledJobContext(); try { job.Execute(scheduledJobContext); } catch (JobExecutionException jee) { jobExecutionException = jee; log.Info(string.Format(CultureInfo.InvariantCulture, "Job {0} threw a JobExecutionException: ", job.Name), jee); } catch (Exception ex) { log.Error(string.Format(CultureInfo.InvariantCulture, "Job {0} threw an unhandled Exception: ", job.Name), ex); SchedulerException se = new SchedulerException("Job threw an unhandled exception.", ex); se.ErrorCode = SchedulerException.ErrorJobExecutionThrewException; jobExecutionException = new JobExecutionException(se, false); jobExecutionException.ErrorCode = JobExecutionException.ErrorJobExecutionThrewException; } SchedulerInstruction instCode = SchedulerInstruction.NoInstruction; try { instCode = trigger.ExecutionComplete(scheduledJobContext, jobExecutionException); } catch (Exception) { // If this happens, there's a bug in the trigger... } // update job/trigger or re-Execute job if (instCode == SchedulerInstruction.ReExecuteJob) { if (log.IsDebugEnabled) { log.Debug("Rescheduling trigger to reexecute"); } continue; } TriggeredJobComplete(trigger, job, instCode); break; } while (true); NotifySchedulerThread(); }
public override void Execute(ScheduledJobContext context) { lock (_serverStream.SyncRoot) { if (_serverStream._vodJobName == null) return; _serverStream._vodJobName = null; if (!_serverStream.DoPushMessage()) { return; } if (_serverStream._state == State.PLAYING) { _serverStream.ScheduleNextMessage(); } else { // Stream is paused, don't load more messages _serverStream._nextRTMPMessage = null; } } }
public virtual SchedulerInstruction ExecutionComplete(ScheduledJobContext context, JobExecutionException result) { if ((result != null) && result.RefireImmediately) { return(SchedulerInstruction.ReExecuteJob); } if ((result != null) && result.UnscheduleFiringTrigger) { return(SchedulerInstruction.SetTriggerComplete); } if ((result != null) && result.UnscheduleAllTriggers) { return(SchedulerInstruction.SetAllJobTriggersComplete); } if (((result == null) || result.RefireImmediately) && !this.GetMayFireAgain()) { return(SchedulerInstruction.DeleteTrigger); } return(SchedulerInstruction.NoInstruction); }
public virtual SchedulerInstruction ExecutionComplete(ScheduledJobContext context, JobExecutionException result) { if (result != null && result.RefireImmediately) return SchedulerInstruction.ReExecuteJob; if (result != null && result.UnscheduleFiringTrigger) return SchedulerInstruction.SetTriggerComplete; if (result != null && result.UnscheduleAllTriggers) return SchedulerInstruction.SetAllJobTriggersComplete; if (result != null && !result.RefireImmediately) return SchedulerInstruction.NoInstruction; if (!GetMayFireAgain()) return SchedulerInstruction.DeleteTrigger; return SchedulerInstruction.NoInstruction; }
public override void Execute(ScheduledJobContext context) { if (!_connection.IsConnected) return; long thisRead = _connection.ReadBytes; long previousReadBytes = _lastBytesRead.Value; if (thisRead > previousReadBytes) { // Client sent data since last check and thus is not dead. No need to ping. if (_lastBytesRead.CompareAndSet(previousReadBytes, thisRead)) _lastBytesReadTime = System.Environment.TickCount; return; } FluorineRtmpContext.Initialize(_connection); if (_connection._lastPongReceived.Value > 0 && _connection._lastPingSent.Value - _connection._lastPongReceived.Value > FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpConnectionSettings.MaxInactivity && !(System.Environment.TickCount - _lastBytesReadTime < FluorineConfiguration.Instance.FluorineSettings.RtmpServer.RtmpConnectionSettings.MaxInactivity)) { try { _connection.ReaderWriterLock.AcquireWriterLock(); // Client didn't send response to ping command for too long, disconnect if (_connection._keepAliveJobName != null) { if (log.IsDebugEnabled) log.Debug(string.Format("{0} Keep alive job name {1}", _connection.ConnectionId, _connection._keepAliveJobName)); ISchedulingService service = _connection.Scope.GetService(typeof(ISchedulingService)) as ISchedulingService; service.RemoveScheduledJob(_connection._keepAliveJobName); _connection._keepAliveJobName = null; } } finally { _connection.ReaderWriterLock.ReleaseWriterLock(); } if (log.IsWarnEnabled) log.Warn(string.Format("{0} Closing due to too much inactivity ({1}ms), last ping sent {2}ms ago", _connection.ConnectionId, _connection._lastPingSent.Value - _connection._lastPongReceived.Value, System.Environment.TickCount - _connection._lastPingSent.Value)); _connection.OnInactive(); return; } // Send ping command to client to trigger sending of data. _connection.Ping(); }
public override void Execute(ScheduledJobContext context) { _connection.ReaderWriterLock.AcquireWriterLock(); try { FluorineRtmpContext.Initialize(_connection); _connection._waitForHandshakeJob = null; if (log.IsWarnEnabled) log.Warn(string.Format("{0} Closing due to long handshake", _connection.ConnectionId)); } finally { _connection.ReaderWriterLock.ReleaseWriterLock(); } // Client didn't send a valid handshake, disconnect. _connection.OnInactive(); }
public abstract void Execute(ScheduledJobContext context);
public override void Execute(ScheduledJobContext context) { try { _engine.PullAndPush(); } catch (Exception ex) { // We couldn't get more data, stop stream. log.Error("Error while getting message.", ex); _engine.Stop(); } }
public override void Execute(ScheduledJobContext context) { //set the msgIn if its null if (_engine._msgIn == null) { _engine.ConnectToProvider(_itemName); } _engine._waitLiveJob = null; _engine._waiting = false; }
public override void Execute(ScheduledJobContext context) { //set the msgIn if its null if (_engine._msgIn == null) { _engine.ConnectToProvider(_itemName); } _engine._waitLiveJob = null; _engine._waiting = false; _engine._playlistSubscriberStream.OnItemEnd(); }
public void ProcessJob(object state) { TriggerFiredBundle bundle = state as TriggerFiredBundle; Trigger trigger = bundle.Trigger; IScheduledJob job = bundle.Job; do { JobExecutionException jobExecutionException = null; ScheduledJobContext scheduledJobContext = new ScheduledJobContext(); try { job.Execute(scheduledJobContext); } catch (JobExecutionException jee) { jobExecutionException = jee; log.Info(string.Format(CultureInfo.InvariantCulture, "Job {0} threw a JobExecutionException: ", job.Name), jee); } catch (Exception ex) { log.Error(string.Format(CultureInfo.InvariantCulture, "Job {0} threw an unhandled Exception: ", job.Name), ex); SchedulerException se = new SchedulerException("Job threw an unhandled exception.", ex); se.ErrorCode = SchedulerException.ErrorJobExecutionThrewException; jobExecutionException = new JobExecutionException(se, false); jobExecutionException.ErrorCode = JobExecutionException.ErrorJobExecutionThrewException; } SchedulerInstruction instCode = SchedulerInstruction.NoInstruction; try { instCode = trigger.ExecutionComplete(scheduledJobContext, jobExecutionException); } catch(Exception) { // If this happens, there's a bug in the trigger... } // update job/trigger or re-Execute job if (instCode == SchedulerInstruction.ReExecuteJob) { if (log.IsDebugEnabled) log.Debug("Rescheduling trigger to reexecute"); continue; } TriggeredJobComplete(trigger, job, instCode); break; } while (true); NotifySchedulerThread(); }