public ClusterSingletonManager(Props singletonProps, object terminationMessage, ClusterSingletonManagerSettings settings)
        {
            var role = settings.Role;

            if (!string.IsNullOrEmpty(role) && !_cluster.SelfRoles.Contains(role))
            {
                throw new ArgumentException(string.Format("This cluster member [{0}] doesn't have the role [{1}]", _cluster.SelfAddress, role));
            }

            _singletonProps     = singletonProps;
            _terminationMessage = terminationMessage;
            _settings           = settings;

            var n = (int)(_settings.RemovalMargin.TotalMilliseconds / _settings.HandOverRetryInterval.TotalMilliseconds);

            _maxHandOverRetries = n + 3;
            _maxTakeOverRetries = Math.Max(1, n - 3);

            InitializeFSM();
        }
Esempio n. 2
0
 private ClusterShardingSettings Copy(
     string role = null,
     bool? rememberEntities = null,
     string journalPluginId = null,
     string snapshotPluginId = null,
     TunningParameters tunningParameters = null,
     ClusterSingletonManagerSettings coordinatorSingletonSettings = null)
 {
     return new ClusterShardingSettings(
         role: role ?? Role,
         rememberEntities: rememberEntities ?? RememberEntities,
         journalPluginId: journalPluginId ?? JournalPluginId,
         snapshotPluginId: snapshotPluginId ?? SnapshotPluginId,
         tunningParameters: tunningParameters ?? TunningParameters,
         coordinatorSingletonSettings: coordinatorSingletonSettings ?? CoordinatorSingletonSettings);
 }
Esempio n. 3
0
        public ClusterShardingSettings WithCoordinatorSingletonSettings(ClusterSingletonManagerSettings coordinatorSingletonSettings)
        {
            if (coordinatorSingletonSettings == null)
                throw new ArgumentNullException("coordinatorSingletonSettings");

            return Copy(coordinatorSingletonSettings: coordinatorSingletonSettings);
        }
Esempio n. 4
0
 public ClusterShardingSettings(
     string role,
     bool rememberEntities,
     string journalPluginId,
     string snapshotPluginId,
     TunningParameters tunningParameters,
     ClusterSingletonManagerSettings coordinatorSingletonSettings)
 {
     Role = role;
     RememberEntities = rememberEntities;
     JournalPluginId = journalPluginId;
     SnapshotPluginId = snapshotPluginId;
     TunningParameters = tunningParameters;
     CoordinatorSingletonSettings = coordinatorSingletonSettings;
 }