/// <summary> /// TBD /// </summary> public ClusterHeartbeatSender() { _cluster = Cluster.Get(Context.System); // the failureDetector is only updated by this actor, but read from other places _failureDetector = _cluster.FailureDetector; _selfHeartbeat = new Heartbeat(_cluster.SelfAddress); _state = new ClusterHeartbeatSenderState( ring: new HeartbeatNodeRing( _cluster.SelfUniqueAddress, ImmutableHashSet.Create(_cluster.SelfUniqueAddress), ImmutableHashSet <UniqueAddress> .Empty, _cluster.Settings.MonitoredByNrOfMembers), oldReceiversNowUnreachable: ImmutableHashSet <UniqueAddress> .Empty, failureDetector: _failureDetector); // start periodic heartbeat to other nodes in cluster _heartbeatTask = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable( _cluster.Settings.PeriodicTasksInitialDelay.Max(_cluster.Settings.HeartbeatInterval), _cluster.Settings.HeartbeatInterval, Self, new HeartbeatTick(), Self); Initializing(); }
public RemoteWatcher( IFailureDetectorRegistry <Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter ) { _failureDetector = failureDetector; _heartbeatExpectedResponseAfter = heartbeatExpectedResponseAfter; var systemProvider = Context.System.AsInstanceOf <ExtendedActorSystem>().Provider as RemoteActorRefProvider; if (systemProvider != null) { _remoteProvider = systemProvider; } else { throw new ConfigurationException(String.Format("ActorSystem {0} needs to have a 'RemoteActorRefProvider' enabled in the configuration, current uses {1}", Context.System, Context.System.AsInstanceOf <ExtendedActorSystem>().Provider.GetType().FullName)); } _heartbeatCancellable = new CancellationTokenSource(); _heartbeatTask = Context.System.Scheduler.Schedule(heartbeatInterval, heartbeatInterval, Self, HeartbeatTick.Instance, _heartbeatCancellable.Token); _failureDetectorReaperCancellable = new CancellationTokenSource(); _failureDetectorReaperTask = Context.System.Scheduler.Schedule(unreachableReaperInterval, unreachableReaperInterval, Self, ReapUnreachableTick.Instance, _failureDetectorReaperCancellable.Token); }
/// <summary> /// TBD /// </summary> /// <param name="ring">TBD</param> /// <param name="oldReceiversNowUnreachable">TBD</param> /// <param name="failureDetector">TBD</param> public ClusterHeartbeatSenderState(HeartbeatNodeRing ring, ImmutableHashSet <UniqueAddress> oldReceiversNowUnreachable, IFailureDetectorRegistry <Address> failureDetector) { Ring = ring; OldReceiversNowUnreachable = oldReceiversNowUnreachable; FailureDetector = failureDetector; ActiveReceivers = Ring.MyReceivers.Value.Union(OldReceiversNowUnreachable); }
public ClusterRemoteWatcher( IFailureDetectorRegistry<Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter) :base(failureDetector, heartbeatInterval, unreachableReaperInterval, heartbeatExpectedResponseAfter) { _cluster = Cluster.Get(Context.System); }
/// <summary> /// TBD /// </summary> /// <param name="failureDetector">TBD</param> /// <param name="heartbeatInterval">TBD</param> /// <param name="unreachableReaperInterval">TBD</param> /// <param name="heartbeatExpectedResponseAfter">TBD</param> public ClusterRemoteWatcher( IFailureDetectorRegistry <Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter) : base(failureDetector, heartbeatInterval, unreachableReaperInterval, heartbeatExpectedResponseAfter) { _cluster = Cluster.Get(Context.System); }
public static Props Props( IFailureDetectorRegistry <Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter) { return(Actor.Props.Create(() => new RemoteWatcher(failureDetector, heartbeatInterval, unreachableReaperInterval, heartbeatExpectedResponseAfter)) .WithDeploy(Deploy.Local)); }
/// <summary> /// Factory method for <see cref="Akka.Remote.RemoteWatcher"/> /// </summary> public static Props Props( IFailureDetectorRegistry<Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter) { return new Props(typeof(ClusterRemoteWatcher), new object[] { failureDetector, heartbeatInterval, unreachableReaperInterval, heartbeatExpectedResponseAfter }).WithDeploy(Deploy.Local); }
/// <summary> /// Factory method for <see cref="Akka.Remote.RemoteWatcher"/> /// </summary> /// <param name="failureDetector">TBD</param> /// <param name="heartbeatInterval">TBD</param> /// <param name="unreachableReaperInterval">TBD</param> /// <param name="heartbeatExpectedResponseAfter">TBD</param> public static Props Props( IFailureDetectorRegistry <Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter) { return(new Props(typeof(ClusterRemoteWatcher), new object[] { failureDetector, heartbeatInterval, unreachableReaperInterval, heartbeatExpectedResponseAfter }).WithDeploy(Deploy.Local)); }
/// <summary> /// TBD /// </summary> /// <param name="failureDetector">TBD</param> /// <param name="heartbeatInterval">TBD</param> /// <param name="unreachableReaperInterval">TBD</param> /// <param name="heartbeatExpectedResponseAfter">TBD</param> /// <exception cref="ConfigurationException"> /// This exception is thrown when the actor system does not have a <see cref="RemoteActorRefProvider"/> enabled in the configuration. /// </exception> public RemoteWatcher( IFailureDetectorRegistry <Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter ) { _failureDetector = failureDetector; _heartbeatExpectedResponseAfter = heartbeatExpectedResponseAfter; var systemProvider = Context.System.AsInstanceOf <ExtendedActorSystem>().Provider as IRemoteActorRefProvider; if (systemProvider != null) { _remoteProvider = systemProvider; } else { throw new ConfigurationException( $"ActorSystem {Context.System} needs to have a 'RemoteActorRefProvider' enabled in the configuration, current uses {Context.System.AsInstanceOf<ExtendedActorSystem>().Provider.GetType().FullName}"); } _heartbeatCancelable = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(heartbeatInterval, heartbeatInterval, Self, HeartbeatTick.Instance, Self); _failureDetectorReaperCancelable = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(unreachableReaperInterval, unreachableReaperInterval, Self, ReapUnreachableTick.Instance, Self); }
public ClusterHeartbeatSenderState Copy(HeartbeatNodeRing ring = null, ImmutableHashSet<UniqueAddress> unreachable = null, IFailureDetectorRegistry<Address> failureDetector = null) { return new ClusterHeartbeatSenderState(ring ?? Ring, unreachable ?? Unreachable, failureDetector ?? FailureDetector); }
public ClusterHeartbeatSenderState(HeartbeatNodeRing ring, ImmutableHashSet<UniqueAddress> unreachable, IFailureDetectorRegistry<Address> failureDetector) { FailureDetector = failureDetector; Unreachable = unreachable; Ring = ring; ActiveReceivers = Ring.MyReceivers.Value.Union(Unreachable); }
/// <summary> /// TBD /// </summary> /// <param name="ring">TBD</param> /// <param name="oldReceiversNowUnreachable">TBD</param> /// <param name="failureDetector">TBD</param> /// <returns>TBD</returns> public ClusterHeartbeatSenderState Copy(HeartbeatNodeRing ring = null, ImmutableHashSet <UniqueAddress> oldReceiversNowUnreachable = null, IFailureDetectorRegistry <Address> failureDetector = null) { return(new ClusterHeartbeatSenderState(ring ?? Ring, oldReceiversNowUnreachable ?? OldReceiversNowUnreachable, failureDetector ?? FailureDetector)); }
public RemoteWatcher( IFailureDetectorRegistry<Address> failureDetector, TimeSpan heartbeatInterval, TimeSpan unreachableReaperInterval, TimeSpan heartbeatExpectedResponseAfter ) { _failureDetector = failureDetector; _heartbeatExpectedResponseAfter = heartbeatExpectedResponseAfter; var systemProvider = Context.System.AsInstanceOf<ExtendedActorSystem>().Provider as RemoteActorRefProvider; if (systemProvider != null) _remoteProvider = systemProvider; else throw new ConfigurationException(String.Format("ActorSystem {0} needs to have a 'RemoteActorRefProvider' enabled in the configuration, current uses {1}", Context.System, Context.System.AsInstanceOf<ExtendedActorSystem>().Provider.GetType().FullName)); _heartbeatCancelable = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(heartbeatInterval, heartbeatInterval, Self, HeartbeatTick.Instance, Self); _failureDetectorReaperCancelable = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(unreachableReaperInterval, unreachableReaperInterval, Self, ReapUnreachableTick.Instance, Self); }