@Test(timeout = 5000) public void testWithoutGrouping2() throws InterruptedException { InputReadyTracker inputReadyTracker = new InputReadyTracker(); ControlledReadyInputForTest input1 = new ControlledReadyInputForTest(inputReadyTracker); ControlledReadyInputForTest input2 = new ControlledReadyInputForTest(inputReadyTracker); ControlledReadyInputForTest input3 = new ControlledReadyInputForTest(inputReadyTracker); List<Input> requestList; long startTime = 0l; long readyTime = 0l; requestList = new ArrayList<Input>(); requestList.add(input1); requestList.add(input2); requestList.add(input3); startTime = System.currentTimeMillis(); setDelayedInputReady(input2); Input readyInput = inputReadyTracker.waitForAnyInputReady(requestList); assertEquals(input2, readyInput); readyTime = System.currentTimeMillis(); assertTrue(input2.isReady); assertTrue(readyTime >= startTime + SLEEP_TIME); assertFalse(input1.isReady); assertFalse(input3.isReady); requestList = new ArrayList<Input>(); requestList.add(input1); requestList.add(input3); startTime = System.currentTimeMillis(); setDelayedInputReady(input1); readyInput = inputReadyTracker.waitForAnyInputReady(requestList); assertEquals(input1, readyInput); readyTime = System.currentTimeMillis(); assertTrue(input1.isReady); assertTrue(readyTime >= startTime + SLEEP_TIME); assertTrue(input2.isReady); assertFalse(input3.isReady); requestList = new ArrayList<Input>(); requestList.add(input3); startTime = System.currentTimeMillis(); setDelayedInputReady(input3); readyInput = inputReadyTracker.waitForAnyInputReady(requestList); assertEquals(input3, readyInput); readyTime = System.currentTimeMillis(); assertTrue(input3.isReady); assertTrue(readyTime >= startTime + SLEEP_TIME); assertTrue(input1.isReady); assertTrue(input2.isReady); }
public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); }
InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); } }
InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); } InputReadyTracker(); }
InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); } InputReadyTracker(); void setInputIsReady(Input input); Input waitForAnyInputReady(Collection<Input> inputs); void waitForAllInputsReady(Collection<Input> inputs); @Override // TODO Remove with TEZ-866 void setInputReady(Input input); void setGroupedInputs(Collection<MergedLogicalInput> inputGroups); }
InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); } InputReadyTracker(); void setInputIsReady(Input input); Input waitForAnyInputReady(Collection<Input> inputs); void waitForAllInputsReady(Collection<Input> inputs); @Override // TODO Remove with TEZ-866 void setInputReady(Input input); void setGroupedInputs(Collection<MergedLogicalInput> inputGroups);  }