private static void HandleRegister <TCoordinator>(this TCoordinator coordinator, PersistentShardCoordinator.Register message) where TCoordinator : IShardCoordinator { var region = message.ShardRegion; if (IsMember(coordinator, region)) { coordinator.Log.Debug("ShardRegion registered: [{0}]", region); coordinator.AliveRegions = coordinator.AliveRegions.Add(region); if (coordinator.CurrentState.Regions.ContainsKey(region)) { region.Tell(new PersistentShardCoordinator.RegisterAck(coordinator.Self)); AllocateShardHomesForRememberEntities(coordinator); } else { var context = coordinator.Context; var self = coordinator.Self; coordinator.GracefullShutdownInProgress = coordinator.GracefullShutdownInProgress.Remove(region); coordinator.Update(new PersistentShardCoordinator.ShardRegionRegistered(region), e => { coordinator.CurrentState = coordinator.CurrentState.Updated(e); context.Watch(region); region.Tell(new PersistentShardCoordinator.RegisterAck(self)); AllocateShardHomesForRememberEntities(coordinator); }); } } else { coordinator.Log.Debug("ShardRegion [{0}] was not registered since the coordinator currently does not know about a node of that region", region); } }