Examples of ConnectionStateListener


Examples of com.brewtab.irc.ConnectionStateListener

         * The connection future and the connection itself aren't perfectly
         * synchronized so we have to wait for both to acknowledge that the
         * connection has been made
         */
        final CountDownLatch connectedLatch = new CountDownLatch(1);
        ConnectionStateListener connectedListener = new ConnectionStateListener() {
            @Override
            public void onConnectionConnected() {
                connectedLatch.countDown();
            }

View Full Code Here

Examples of com.netflix.curator.framework.state.ConnectionStateListener

      String authority = url.getAuthority();
      if (authority != null && authority.length() > 0) {
        builder = builder.authorization("digest", authority.getBytes());
      }
      client = builder.build();
      client.getConnectionStateListenable().addListener(new ConnectionStateListener() {
        public void stateChanged(CuratorFramework client, ConnectionState state) {
          if (state == ConnectionState.LOST) {
            CuratorZookeeperClient.this.stateChanged(StateListener.DISCONNECTED);
          } else if (state == ConnectionState.CONNECTED) {
            CuratorZookeeperClient.this.stateChanged(StateListener.CONNECTED);
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

        try
        {
            client.start();

            final CountDownLatch lostLatch = new CountDownLatch(1);
            ConnectionStateListener listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    if ( newState == ConnectionState.LOST )
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

        try
        {
            final CountDownLatch latch = new CountDownLatch(1);
            client.getConnectionStateListenable().addListener
                (
                    new ConnectionStateListener()
                    {
                        @Override
                        public void stateChanged(CuratorFramework client, ConnectionState newState)
                        {
                            if ( newState == ConnectionState.LOST )
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

        // use a connection string to a non-existent server
        CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:1111", 100, 100, new RetryOneTime(1));
        try
        {
            final BlockingQueue<ConnectionState> queue = Queues.newLinkedBlockingQueue();
            ConnectionStateListener listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState state)
                {
                    queue.add(state);
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

        Timing                  timing = new Timing();
        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        try
        {
            final BlockingQueue<ConnectionState>        queue = new LinkedBlockingQueue<ConnectionState>();
            ConnectionStateListener                     listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    queue.add(newState);
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

            .build();
        client.start();
        try
        {
            final CountDownLatch lostLatch = new CountDownLatch(1);
            ConnectionStateListener listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    if ( newState == ConnectionState.LOST )
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

        Validate.notEmpty(sampleRateZNode);
        this.sampleRateZNode = sampleRateZNode;

        final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
        zkCurator = CuratorFrameworkFactory.newClient(connectionString, retryPolicy);
        final ConnectionStateListener initialConnectionState = new InitialConnectionStateListener();
        zkCurator.getConnectionStateListenable().addListener(initialConnectionState);
        zkCurator.start();

        if (connectionEstablished.await(2, TimeUnit.SECONDS) == false) {
            zkCurator.close();
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

                .build();

            final BlockingQueue<ConnectionState> states = Queues.newLinkedBlockingQueue();
            client.getConnectionStateListenable().addListener
            (
                new ConnectionStateListener()
                {
                    @Override
                    public void stateChanged(CuratorFramework client, ConnectionState newState)
                    {
                        states.add(newState);
View Full Code Here

Examples of org.apache.curator.framework.state.ConnectionStateListener

            client.create().forPath("/test");

            final CountDownLatch readOnlyLatch = new CountDownLatch(1);
            final CountDownLatch reconnectedLatch = new CountDownLatch(1);
            ConnectionStateListener listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    if ( newState == ConnectionState.READ_ONLY )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.