Skip to content

Commit

Permalink
CURATOR-147 Remove use of deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Drob committed Sep 11, 2014
1 parent f9c6919 commit 8929343
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void addFailedDelete(String path)
}


if ( client.isStarted() )
if ( client.getState() == CuratorFrameworkState.STARTED )
{
log.debug("Path being added to guaranteed delete set: " + path);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Ex
}
);

client2.sync("/test", null);
client2.sync().forPath("/test");

Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public void testIsStarted() throws Exception
client.start();
CuratorFramework namespaced = client.usingNamespace(null);

Assert.assertEquals(client.isStarted(), namespaced.isStarted());
Assert.assertEquals(client.getState(), namespaced.getState(), "Namespaced state did not match true state after call to start.");

client.close();
Assert.assertEquals(client.isStarted(), namespaced.isStarted());
Assert.assertEquals(client.getState(), namespaced.getState(), "Namespaced state did not match true state after call to close.");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testWithNamespace() throws Exception
.commit();

Assert.assertTrue(client.checkExists().forPath("/foo") != null);
Assert.assertTrue(client.nonNamespaceView().checkExists().forPath("/galt/foo") != null);
Assert.assertTrue(client.usingNamespace(null).checkExists().forPath("/galt/foo") != null);
Assert.assertEquals(client.getData().forPath("/foo"), "two".getBytes());
Assert.assertTrue(client.checkExists().forPath("/foo/bar") == null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;

import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.BackgroundCallback;
import org.apache.curator.framework.api.CuratorEvent;
import org.apache.curator.framework.api.CuratorEventType;
import org.apache.curator.framework.imps.CuratorFrameworkState;
import org.apache.curator.framework.listen.ListenerContainer;
import org.apache.curator.framework.recipes.leader.LeaderSelector;
import org.apache.curator.utils.ZKPaths;
Expand Down Expand Up @@ -702,7 +704,7 @@ private boolean processNormally(String itemNode, ProcessType type) throws Except
{
bytes = client.getData().storingStatIn(stat).forPath(itemPath);
}
if ( client.isStarted() )
if ( client.getState() == CuratorFrameworkState.STARTED )
{
client.delete().withVersion(stat.getVersion()).forPath(itemPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testLostRestart() throws Exception
{
client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
client.start();
client.sync("/", null);
client.sync().forPath("/");

final AtomicReference<Exception> error = new AtomicReference<Exception>(null);
final AtomicReference<String> lockNode = new AtomicReference<String>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.imps.CuratorFrameworkState;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.retry.RetryOneTime;
import org.apache.curator.test.BaseClassForTests;
Expand Down Expand Up @@ -115,7 +116,7 @@ public void process(WatchedEvent event)
}
};

while ( !Thread.currentThread().isInterrupted() && client.isStarted() && !isDone.get() )
while ( !Thread.currentThread().isInterrupted() && client.getState() == CuratorFrameworkState.STARTED && !isDone.get() )
{
synchronized(lock)
{
Expand Down

0 comments on commit 8929343

Please sign in to comment.