Examples of PersistentEphemeralNode


Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        byte[] data = ServiceEndPointJsonCodec.toJson(endPoint, registrationData).getBytes(Charsets.UTF_8);
        checkState(data.length < MAX_DATA_SIZE, "Serialized form of ServiceEndPoint must be < 1MB.");

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode oldNode = _nodes.put(path, _nodeFactory.create(path, data));
        if (oldNode != null) {
            closeNode(oldNode);
        }

        String serviceName = endPoint.getServiceName();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

    public void unregister(ServiceEndPoint endPoint) {
        checkState(!_closed);
        checkNotNull(endPoint);

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode node = _nodes.remove(path);
        if (node != null) {
            closeNode(node);

            String serviceName = endPoint.getServiceName();
            _numRegisteredEndpoints.getUnchecked(serviceName).dec();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        NodeFactory(CuratorFramework curator) {
            _curator = checkNotNull(curator);
        }

        PersistentEphemeralNode create(String path, byte[] data) {
            return new PersistentEphemeralNode(_curator, path, data, CreateMode.EPHEMERAL);
        }
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        byte[] data = ServiceEndPointJsonCodec.toJson(endPoint, registrationData).getBytes(Charsets.UTF_8);
        checkState(data.length < MAX_DATA_SIZE, "Serialized form of ServiceEndPoint must be < 1MB.");

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode oldNode = _nodes.put(path, _nodeFactory.create(path, data));
        if (oldNode != null) {
            closeNode(oldNode);
        }

        String serviceName = endPoint.getServiceName();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

    public void unregister(ServiceEndPoint endPoint) {
        checkState(!_closed);
        checkNotNull(endPoint);

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode node = _nodes.remove(path);
        if (node != null) {
            closeNode(node);

            String serviceName = endPoint.getServiceName();
            _numRegisteredEndpoints.getUnchecked(serviceName).dec();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        NodeFactory(CuratorFramework curator) {
            _curator = checkNotNull(curator);
        }

        PersistentEphemeralNode create(String path, byte[] data) {
            return new PersistentEphemeralNode(_curator, path, data, CreateMode.EPHEMERAL);
        }
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        byte[] data = ServiceEndPointJsonCodec.toJson(endPoint, registrationData).getBytes(Charsets.UTF_8);
        checkState(data.length < MAX_DATA_SIZE, "Serialized form of ServiceEndPoint must be < 1MB.");

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode oldNode = _nodes.put(path, _nodeFactory.create(path, data));
        if (oldNode != null) {
            closeNode(oldNode);
        }

        String serviceName = endPoint.getServiceName();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

    public void unregister(ServiceEndPoint endPoint) {
        checkState(!_closed);
        checkNotNull(endPoint);

        String path = makeEndPointPath(endPoint);
        PersistentEphemeralNode node = _nodes.remove(path);
        if (node != null) {
            closeNode(node);

            String serviceName = endPoint.getServiceName();
            _numRegisteredEndpoints.getUnchecked(serviceName).dec();
View Full Code Here

Examples of com.bazaarvoice.curator.recipes.PersistentEphemeralNode

        NodeFactory(CuratorFramework curator) {
            _curator = checkNotNull(curator);
        }

        PersistentEphemeralNode create(String path, byte[] data) {
            return new PersistentEphemeralNode(_curator, path, data, CreateMode.EPHEMERAL);
        }
View Full Code Here

Examples of org.apache.curator.framework.recipes.nodes.PersistentEphemeralNode

        Timing timing = new Timing();
        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        try
        {
            client.start();
            PersistentEphemeralNode node = new PersistentEphemeralNode(client, PersistentEphemeralNode.Mode.EPHEMERAL, "/abc/node", "hello".getBytes());
            node.start();

            final CountDownLatch connectedLatch = new CountDownLatch(1);
            final CountDownLatch reconnectedLatch = new CountDownLatch(1);
            final AtomicReference<ConnectionState> lastState = new AtomicReference<ConnectionState>();
            ConnectionStateListener listener = new ConnectionStateListener()
            {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    lastState.set(newState);
                    if ( newState == ConnectionState.CONNECTED )
                    {
                        connectedLatch.countDown();
                    }
                    if ( newState == ConnectionState.RECONNECTED )
                    {
                        reconnectedLatch.countDown();
                    }
                }
            };
            client.getConnectionStateListenable().addListener(listener);
            timing.sleepABit();
            server = new TestingServer(server.getPort());
            Assert.assertTrue(timing.awaitLatch(connectedLatch));
            timing.sleepABit();
            Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS));
            server.close();
            timing.sleepABit();
            server = new TestingServer(server.getPort());
            timing.sleepABit();
            Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
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.