Java Code Examples for java.util.List.wait()

The following are Jave code examples for showing how to use wait() of the java.util.List class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: https-github.com-apache-zookeeper   File: ReconfigTest.java   View Source Code Vote up 5 votes
@Test
public void testRemoveOneAsynchronous() throws Exception {
    qu = new QuorumUtil(2); 
    qu.disableJMXTest = true;
    qu.startAll();
    ZooKeeper[] zkArr = createHandles(qu);
    ZooKeeperAdmin[] zkAdminArr = createAdminHandles(qu);

    List<String> leavingServers = new ArrayList<String>();
   
    // lets remove someone who's not the leader
    leavingServers.add(getLeaderId(qu) == 5 ? "4": "5");
 
    List<Integer> results = new LinkedList<Integer>();
    
    zkAdminArr[1].reconfigure(null, leavingServers, null, -1, this, results);
    
    synchronized (results) {
        while (results.size() < 1) {
           results.wait();
        }
    }        
    Assert.assertEquals(0, (int) results.get(0));
    
    testNormalOperation(zkArr[1], zkArr[2]);       
    for (int i=1; i<=5; i++)
        testServerHasConfig(zkArr[i], null, leavingServers);

    closeAllHandles(zkArr, zkAdminArr);
}