Package org.apache.curator.framework

Examples of org.apache.curator.framework.CuratorFramework.inTransaction()


            client.create().forPath("/foo");
            Stat        stat = client.setData().forPath("/foo", "new".getBytes())// up the version

            try
            {
                client.inTransaction()
                    .check().withVersion(stat.getVersion() + 1).forPath("/foo") // force a bad version
                .and()
                    .create().forPath("/bar")
                .and()
                    .commit();
View Full Code Here


        CuratorFramework        client = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).namespace("galt").build();
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo", "one".getBytes())
                .and()
                    .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/test-", "one".getBytes())
                .and()
                    .setData().forPath("/foo", "two".getBytes())
View Full Code Here

        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo")
                .and()
                    .create().forPath("/foo/bar", "snafu".getBytes())
                .and()
                    .commit();
View Full Code Here

            client.create().forPath("/foo");
            Stat        stat = client.setData().forPath("/foo", "new".getBytes())// up the version

            try
            {
                client.inTransaction()
                    .check().withVersion(stat.getVersion() + 1).forPath("/foo") // force a bad version
                .and()
                    .create().forPath("/bar")
                .and()
                    .commit();
View Full Code Here

        CuratorFramework        client = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).namespace("galt").build();
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo", "one".getBytes())
                .and()
                    .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/test-", "one".getBytes())
                .and()
                    .setData().forPath("/foo", "two".getBytes())
View Full Code Here

        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo")
                .and()
                    .create().forPath("/foo/bar", "snafu".getBytes())
                .and()
                    .commit();
View Full Code Here

            client.create().forPath("/foo");
            Stat        stat = client.setData().forPath("/foo", "new".getBytes())// up the version

            try
            {
                client.inTransaction()
                    .check().withVersion(stat.getVersion() + 1).forPath("/foo") // force a bad version
                .and()
                    .create().forPath("/bar")
                .and()
                    .commit();
View Full Code Here

        CuratorFramework        client = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).namespace("galt").build();
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo", "one".getBytes())
                .and()
                    .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/test-", "one".getBytes())
                .and()
                    .setData().forPath("/foo", "two".getBytes())
View Full Code Here

        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
        client.start();
        try
        {
            Collection<CuratorTransactionResult>    results =
                client.inTransaction()
                    .create().forPath("/foo")
                .and()
                    .create().forPath("/foo/bar", "snafu".getBytes())
                .and()
                    .commit();
View Full Code Here

        try
        {
            client.start();

            //Create uncompressed data in a transaction
            client.inTransaction().create().forPath(path, data).and().commit();
            Assert.assertEquals(data, client.getData().forPath(path));

            //Create compressed data in transaction
            client.inTransaction().setData().compressed().forPath(path, data).and().commit();
            Assert.assertEquals(data, client.getData().decompressed().forPath(path));
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.