Examples of waitMsecs()


Examples of org.apache.giraph.zk.BspEvent.waitMsecs()

  @Test
  public void testWaitMsecs() {
    BspEvent event = new PredicateLock(getStubProgressable());
    Thread signalThread = new SignalThread(event);
    signalThread.start();
    boolean gotPredicate = event.waitMsecs(2000);
    assertTrue(gotPredicate);
    try {
      signalThread.join();
    } catch (InterruptedException e) {
    }
View Full Code Here

Examples of org.apache.giraph.zk.BspEvent.waitMsecs()

    assertTrue(gotPredicate);
    try {
      signalThread.join();
    } catch (InterruptedException e) {
    }
    gotPredicate = event.waitMsecs(0);
    assertTrue(gotPredicate);
  }
}
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

    /**
     * Make sure the the event is not signaled.
     */
    public void testWaitMsecsNoEvent() {
        BspEvent event = new PredicateLock();
        boolean gotPredicate = event.waitMsecs(50);
        assertTrue(gotPredicate == false);
    }

    /**
     * Single threaded case
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

     * Single threaded case
     */
    public void testEvent() {
        BspEvent event = new PredicateLock();
        event.signal();
        boolean gotPredicate = event.waitMsecs(-1);
        assertTrue(gotPredicate == true);
        event.reset();
        gotPredicate = event.waitMsecs(0);
        assertTrue(gotPredicate == false);
    }
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

        BspEvent event = new PredicateLock();
        event.signal();
        boolean gotPredicate = event.waitMsecs(-1);
        assertTrue(gotPredicate == true);
        event.reset();
        gotPredicate = event.waitMsecs(0);
        assertTrue(gotPredicate == false);
    }

    /**
     * Make sure the the event is signaled correctly
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

    public void testWaitMsecs() {
        System.out.println("testWaitMsecs:");
        BspEvent event = new PredicateLock();
        Thread signalThread = new SignalThread(event);
        signalThread.start();
        boolean gotPredicate = event.waitMsecs(2000);
        assertTrue(gotPredicate == true);
        try {
            signalThread.join();
        } catch (InterruptedException e) {
        }
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

        assertTrue(gotPredicate == true);
        try {
            signalThread.join();
        } catch (InterruptedException e) {
        }
        gotPredicate = event.waitMsecs(0);
        assertTrue(gotPredicate == true);
    }
}
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

  public void testWaitMsecsNoEvent() {
    Time mockTime = mock(Time.class);
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    BspEvent event = new PredicateLock(getStubProgressable(), 1, mockTime);
    boolean gotPredicate = event.waitMsecs(1);
    assertFalse(gotPredicate);
    assertEquals(0, progressCalled.get());
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(0L).thenReturn(2L);
    gotPredicate = event.waitMsecs(1);
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

    boolean gotPredicate = event.waitMsecs(1);
    assertFalse(gotPredicate);
    assertEquals(0, progressCalled.get());
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(0L).thenReturn(2L);
    gotPredicate = event.waitMsecs(1);
    assertFalse(gotPredicate);
    assertEquals(1, progressCalled.get());
  }

  /**
 
View Full Code Here

Examples of org.apache.giraph.zk.PredicateLock.waitMsecs()

    Time mockTime = mock(Time.class);
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    BspEvent event = new PredicateLock(getStubProgressable(), 1, mockTime);
    event.signal();
    boolean gotPredicate = event.waitMsecs(2);
    assertTrue(gotPredicate);
    event.reset();
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    gotPredicate = event.waitMsecs(0);
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.