public void Can_JoinElectionByUseTheSameZKConnection()
        {
            IZooKeeper zookeeper = new ZooKeeper("127.0.0.1:2181", new TimeSpan(0, 60, 0), null);
            Server     server1   = new Server()
            {
                ShardName = "shard1",
                Host      = "127.0.0.1",
                Port      = 6369,
                paramStr  = "allowAdmin=true",
                Path      = ZkPath.ShardsPath(ZkPath.CollectionName)
            };
            Server server2 = new Server()
            {
                ShardName = "shard1",
                Host      = "127.0.0.1",
                Port      = 6379,
                paramStr  = "allowAdmin=true",
                Path      = ZkPath.ShardsPath(ZkPath.CollectionName)
            };

            ServerInstances si = new ServerInstances();

            si.Add(new ServerInst(server1.Host, server1.Port, "allowAdmin=true"));
            si.Add(new ServerInst(server2.Host, server2.Port, "allowAdmin=true"));

            LeaderContext context1 = new LeaderContext(zookeeper, server1);

            context1.JoinElection();
            LeaderContext context2 = new LeaderContext(zookeeper, server2);

            context2.JoinElection();
        }
        public void Can_JoinElectionTwiceSep()
        {
            IZooKeeper zookeeper1 = new ZooKeeper("127.0.0.1:2181", new TimeSpan(0, 60, 0), null);
            IZooKeeper zookeeper2 = new ZooKeeper("127.0.0.1:2181", new TimeSpan(0, 60, 0), null);
            Server     server     = new Server()
            {
                ShardName = "shard1",
                Host      = "127.0.0.1",
                Port      = 6369,
                paramStr  = "allowAdmin=true",
                Path      = ZkPath.ShardsPath(ZkPath.CollectionName)
            };

            ServerInstances si = new ServerInstances();

            si.Add(new ServerInst(server.Host, server.Port, "allowAdmin=true"));

            //LeaderContext context = new LeaderContext(zookeeper, server);
            //context.JoinElection();
        }
 public ItemZkRegisteredEventHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
 public PingCommandHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
Example #5
0
 public SlaveOfCommandHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
Example #6
0
 public RegistryZkService(ServerInstances serverInstances, IZooKeeper zookeeper)
 {
     this.serverInstances = serverInstances;
     this.zookeeper       = zookeeper;
 }
Example #7
0
 public BeLeaderCommandHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
Example #8
0
 public ItemSlavedOfEventHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
 public ItemPingedEventHandler(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }
Example #10
0
 public ServerInstRepository(ServerInstances serverInstances)
 {
     this.serverInstances = serverInstances;
 }