Ejemplo n.º 1
0
            public override Task process(WatchedEvent @event)
            {
                if (@event.get_Type() == EventType.None)
                {
                    switch (@event.getState())
                    {
                    case KeeperState.Disconnected:
                    {
                        Logger.GetLogger(service.BaseUrl).Error("disconnected with zookeeper server");
                        //wait 5 second.
                        Thread.Sleep(5000);
                        if (!service.force)
                        {
                            service.Start();
                        }
                        service.force = false;
                        break;
                    }

                    case KeeperState.Expired:
                    {
                        Logger.GetLogger(service.BaseUrl).Error("connected expired! reconnect!");
                        service.Start();
                        break;
                    }

                    case KeeperState.SyncConnected:
                    {
                        Logger.GetLogger(service.BaseUrl).Info("zookeeper server connected!");
                        resetEvent.Set();
                        break;
                    }

                    case KeeperState.ConnectedReadOnly:
                    {
                        Logger.GetLogger(service.BaseUrl).Info("zookeeper server ConnectedReadOnly!");
                        break;
                    }

                    case KeeperState.AuthFailed:
                    {
                        break;
                    }
                    }
                }

                return(Task.CompletedTask);
            }
Ejemplo n.º 2
0
            public void Process(WatchedEvent @event)
            {
                if (@event.Type == EventType.None)
                {
                    switch (@event.State)
                    {
                    case KeeperState.Disconnected:
                    {
                        Logger.GetLogger(service.BaseUrl).Error("disconnected with zookeeper server");
                        //wait 5 second.
                        Thread.Sleep(5000);
                        if (!service.force)
                        {
                            service.Start();
                        }
                        service.force = false;
                        break;
                    }

                    case KeeperState.Expired:
                    {
                        Logger.GetLogger(service.BaseUrl).Error("connected expired! reconnect!");
                        service.Start();
                        break;
                    }

                    case KeeperState.SyncConnected:
                    {
                        Logger.GetLogger(service.BaseUrl).Info("zookeeper server connected!");
                        resetEvent.Set();
                        break;
                    }

                    case KeeperState.NoSyncConnected:
                    {
                        Logger.GetLogger(service.BaseUrl).Info("zookeeper server NoSyncConnected!");
                        break;
                    }

                    case KeeperState.Unknown:
                    {
                        break;
                    }
                    }
                }
            }
Ejemplo n.º 3
0
            public void Process(WatchedEvent @event)
            {
                if (@event.Type == EventType.None)
                {
                    switch (@event.State)
                    {
                    case KeeperState.Disconnected:
                    {
                        Console.WriteLine("disconnected with zookeeper server");
                        if (!service.force)
                        {
                            service.Start();
                        }
                        service.force = false;
                        break;
                    }

                    case KeeperState.Expired:
                    {
                        Console.WriteLine("connected expired! reconnect!");
                        service.Start();
                        break;
                    }

                    case KeeperState.SyncConnected:
                    {
                        Console.WriteLine("zookeeper server connected!");
                        resetEvent.Set();
                        break;
                    }

                    case KeeperState.NoSyncConnected:
                    {
                        Console.WriteLine("zookeeper server NoSyncConnected!");
                        break;
                    }

                    case KeeperState.Unknown:
                    {
                        break;
                    }
                    }
                }
            }