public void Close() { lock (ThisLock) { isOpen = false; } maintainerTimer.Cancel(); // No reconnect while closed SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); MaintainerClosedHandler handler = MaintainerClosed; if (handler != null) { handler(); } }
bool RemoveTimer(IPeerNeighbor neighbor) { IOThreadTimer timer = null; bool removed = false; // Remove the timer from the table and cancel it. Do this if Connector is // still open. Otherwise, Close method will have already cancelled the timers. lock (ThisLock) { if (this.state == State.Opened && this.timerTable.TryGetValue(neighbor, out timer)) { removed = this.timerTable.Remove(neighbor); } } if (timer != null) { timer.Cancel(); if (!removed) { throw Fx.AssertAndThrow("Neighbor key should have beeen removed from the table"); } } return(removed); }
internal void StartCheckForAvailability(string path) { bool flag = false; if (this.availableEntities.ContainsKey(path)) { if (this.availableEntities.TryUpdate(path, false, true)) { flag = true; } } else if (this.availableEntities.TryAdd(path, false)) { flag = true; } if (flag && this.availabilityTimers.TryAdd(path, null)) { IOThreadTimer oThreadTimer = new IOThreadTimer(new Action <object>(this.AvailabilityCallback), path, false); if (this.availabilityTimers.TryUpdate(path, oThreadTimer, null) && !this.Closed) { oThreadTimer.Set(this.PingPrimaryInterval); return; } oThreadTimer.Cancel(); } }
// Unregister address for a node from the resolver service public override void Unregister(object registrationId, TimeSpan timeout) { if (opened) { UnregisterInfo info = new UnregisterInfo(this.meshId, this.registrationId); try { IPeerResolverClient proxy = GetProxy(); try { proxy.OperationTimeout = timeout; proxy.Unregister(info); proxy.Close(); } finally { proxy.Abort(); } } catch (CommunicationException e) { DiagnosticUtility.TraceHandledException(e, TraceEventType.Information); } finally { opened = false; timer.Cancel(); } } }
void CancelFlushTimer() { if (flushTimer != null) { flushTimer.Cancel(); pendingTimeout = TimeSpan.Zero; } }
private void CancelTimerIfNeeded() { if (Count == 0 && _purgingTimer != null) { _purgingTimer.Cancel(); _purgingTimer = null; } }
public void Signal(IEnumerable <AmqpMessage> messages, bool syncComplete, Exception exception) { IOThreadTimer oThreadTimer = this.timer; if (oThreadTimer != null) { oThreadTimer.Cancel(); } this.CompleteInternal(messages, syncComplete, 1, exception); }
public void Detach(IPeerNeighbor host) { ackTimer.Cancel(); owner = null; lock (throttleLock) { pruneTimer.Cancel(); } }
private void CancelSendTimer() { IOThreadTimer oThreadTimer = this.sendTimer; this.sendTimer = null; if (oThreadTimer != null) { oThreadTimer.Cancel(); } }
private void CancelReceiveTimer() { IOThreadTimer oThreadTimer = this.receiveTimer; this.receiveTimer = null; if (oThreadTimer != null) { oThreadTimer.Cancel(); } }
public void Signal(AmqpMessage message, bool syncComplete) { IOThreadTimer t = this.timer; if (t != null) { t.Cancel(); } this.CompleteInternal(message, syncComplete); }
internal void Close() { lock (ThisLock) { if (disposed) { return; } messagePruningTimer.Cancel(); messagePruningTimer = null; tables = null; disposed = true; } }
private bool RemoveTimer(IPeerNeighbor neighbor) { IOThreadTimer timer = null; bool flag = false; lock (this.ThisLock) { if ((this.state == State.Opened) && this.timerTable.TryGetValue(neighbor, out timer)) { flag = this.timerTable.Remove(neighbor); } } if (timer != null) { timer.Cancel(); if (!flag) { throw Fx.AssertAndThrow("Neighbor key should have beeen removed from the table"); } } return(flag); }
public virtual void Close() { ThrowIfClosed("Close"); timer.Cancel(); opened = false; }