Skip to content

Commit

Permalink
(issue #29) speeding up test
Browse files Browse the repository at this point in the history
  • Loading branch information
bluestreak01 committed Jan 28, 2015
1 parent 4874f0d commit bb88593
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014. Vlad Ilyushchenko
* Copyright (c) 2014-2015. Vlad Ilyushchenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -230,9 +230,9 @@ private void vote(boolean startup) throws JournalNetworkException {

// always stop client because we will create new one when looking for ALPHA
haltClient();
Thread.yield();
}


if (!isClient) {
// after this point server cannot be voted out and it becomes the ALPHA
server.setIgnoreVoting(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void testFiveNodesVoting() throws Exception {
long t;

t = System.currentTimeMillis();
while (standby.get() < 4 && TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - t) < 30) {
while (standby.get() < 4 && TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - t) < 120) {
Thread.yield();
}

Expand All @@ -207,7 +207,7 @@ public void testFiveNodesVoting() throws Exception {
// c1.halt();
//
t = System.currentTimeMillis();
while (standby.get() < 3 && TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - t) < 30) {
while (standby.get() < 3 && TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - t) < 120) {
Thread.yield();
}
//
Expand Down Expand Up @@ -402,11 +402,11 @@ public void onShutdown() {
private ClusterController createController2(int instance, final JournalFactory fact, final AtomicInteger active, final AtomicInteger standby, final AtomicInteger shutdown) throws JournalException {
return new ClusterController(
new ServerConfig() {{
addNode(new ServerNode(0, "localhost:7040"));
addNode(new ServerNode(1, "localhost:7041"));
addNode(new ServerNode(4, "localhost:7040"));
addNode(new ServerNode(3, "localhost:7041"));
addNode(new ServerNode(2, "localhost:7042"));
addNode(new ServerNode(3, "localhost:7043"));
addNode(new ServerNode(4, "localhost:7044"));
addNode(new ServerNode(1, "localhost:7043"));
addNode(new ServerNode(0, "localhost:7044"));
setEnableMultiCast(false);
}},
new ClientConfig() {{
Expand Down

0 comments on commit bb88593

Please sign in to comment.