/// <summary> /// Adds a heartbeat task on session thread after the given delay. /// </summary> private void submitTask(long scheduleTimeMs) { if (log.IsDebugEnabled) { log.Debug("rhb scheduled +" + scheduleTimeMs + " ph " + currentPhase); } sessionThread.schedule(new Task(() => { int phase = currentPhase; if (log.IsDebugEnabled) { log.Debug("rhb task fired ph " + phase); } if (phase < this.currentPhase) { if (log.IsDebugEnabled) { log.Debug("rhb task discarded ph " + phase); } return; } Debug.Assert(phase == this.currentPhase); this.schedule(); }), scheduleTimeMs); }
protected internal virtual void startTimeout() { if (!timeoutIsRunning) { timeoutIsRunning = true; sessionThread.schedule(new System.Threading.Tasks.Task(() => { onTimeout(); }), Timeout); } }