|
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.zookeeper.common.Time;
|
|
|
import org.apache.jute.BinaryInputArchive;
|
|
|
import org.apache.jute.BinaryOutputArchive;
|
|
|
import org.apache.jute.Record;
|
|
@@ -236,7 +237,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
dt.createNode("/test", new byte[0], null, 0, -1, 1, 1);
|
|
|
for (count = 1; count <= 3; count++) {
|
|
|
dt.createNode("/test/" + count, new byte[0], null, 0, -1, count,
|
|
|
- System.currentTimeMillis());
|
|
|
+ Time.currentElapsedTime());
|
|
|
}
|
|
|
DataNode zk = dt.getNode("/test");
|
|
|
|
|
@@ -285,15 +286,15 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
if (type == OpCode.delete) {
|
|
|
txn = new DeleteTxn(path);
|
|
|
txnHeader = new TxnHeader(0xabcd, 0x123, prevPzxid + 1,
|
|
|
- System.currentTimeMillis(), OpCode.delete);
|
|
|
+ Time.currentElapsedTime(), OpCode.delete);
|
|
|
} else if (type == OpCode.create) {
|
|
|
txnHeader = new TxnHeader(0xabcd, 0x123, prevPzxid + 1,
|
|
|
- System.currentTimeMillis(), OpCode.create);
|
|
|
+ Time.currentElapsedTime(), OpCode.create);
|
|
|
txn = new CreateTxn(path, new byte[0], null, false, cversion);
|
|
|
}
|
|
|
else if (type == OpCode.multi) {
|
|
|
txnHeader = new TxnHeader(0xabcd, 0x123, prevPzxid + 1,
|
|
|
- System.currentTimeMillis(), OpCode.create);
|
|
|
+ Time.currentElapsedTime(), OpCode.create);
|
|
|
txn = new CreateTxn(path, new byte[0], null, false, cversion);
|
|
|
ArrayList txnList = new ArrayList();
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
@@ -304,7 +305,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
txnList.add(txact);
|
|
|
txn = new MultiTxn(txnList);
|
|
|
txnHeader = new TxnHeader(0xabcd, 0x123, prevPzxid + 1,
|
|
|
- System.currentTimeMillis(), OpCode.multi);
|
|
|
+ Time.currentElapsedTime(), OpCode.multi);
|
|
|
}
|
|
|
logFile.processTransaction(txnHeader, dt, null, txn);
|
|
|
|
|
@@ -331,7 +332,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
File tmpDir = ClientBase.createTmpDir();
|
|
|
FileTxnLog txnLog = new FileTxnLog(tmpDir);
|
|
|
TxnHeader txnHeader = new TxnHeader(0xabcd, 0x123, 0x123,
|
|
|
- System.currentTimeMillis(), OpCode.create);
|
|
|
+ Time.currentElapsedTime(), OpCode.create);
|
|
|
Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
|
|
|
txnLog.append(txnHeader, txn);
|
|
|
FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
|
|
@@ -568,9 +569,9 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
private ZooKeeper getConnectedZkClient() throws IOException {
|
|
|
ZooKeeper zk = new ZooKeeper(HOSTPORT, CONNECTION_TIMEOUT, this);
|
|
|
|
|
|
- long start = System.currentTimeMillis();
|
|
|
+ long start = Time.currentElapsedTime();
|
|
|
while (!connected) {
|
|
|
- long end = System.currentTimeMillis();
|
|
|
+ long end = Time.currentElapsedTime();
|
|
|
if (end - start > 5000) {
|
|
|
Assert.assertTrue("Could not connect with server in 5 seconds",
|
|
|
false);
|