Examples of MasterOperation


Examples of net.sf.katta.operation.master.MasterOperation

  }

  @Test(timeout = 10000)
  public void testInterruptedException_Operation() throws Exception {
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    final MasterOperation masterOperation = mockOperation(ExecutionInstruction.EXECUTE);
    when(masterOperation.execute(_context, EMPTY_LIST)).thenThrow(new InterruptedException());
    when(_queue.peek()).thenReturn(masterOperation);
    OperatorThread operatorThread = new OperatorThread(_context, 50);
    operatorThread.start();
    operatorThread.join();
  }
View Full Code Here

Examples of net.sf.katta.operation.master.MasterOperation

  @Test(timeout = 1000000)
  public void testInterruptedException_Operation_Zk() throws Exception {
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    ZkInterruptedException zkInterruptedException = mock(ZkInterruptedException.class);
    final MasterOperation masterOperation = mockOperation(ExecutionInstruction.EXECUTE);
    when(masterOperation.execute(_context, EMPTY_LIST)).thenThrow(zkInterruptedException);
    when(_queue.peek()).thenReturn(masterOperation);
    OperatorThread operatorThread = new OperatorThread(_context, 50);
    operatorThread.start();
    operatorThread.join();
  }
View Full Code Here

Examples of net.sf.katta.operation.master.MasterOperation

    operatorThread.interrupt();
    operatorThread.join();
  }

  private MasterOperation mockOperation(ExecutionInstruction instruction) throws Exception {
    MasterOperation masterOperation = mock(MasterOperation.class);
    when(masterOperation.getExecutionInstruction((List<MasterOperation>) notNull())).thenReturn(instruction);
    return masterOperation;
  }
View Full Code Here

Examples of net.sf.katta.operation.master.MasterOperation

      while (true) {
        try {
          // TODO jz: poll only for a certain amount of time and then execute a
          // global check operation ?
          MasterOperation operation = _queue.peek();
          List<OperationId> nodeOperationIds = null;
          try {
            List<MasterOperation> runningOperations = _registry.getRunningOperations();
            ExecutionInstruction instruction = operation.getExecutionInstruction(runningOperations);
            nodeOperationIds = executeOperation(operation, instruction, runningOperations);
          } catch (Exception e) {
            ExceptionUtil.rethrowInterruptedException(e);
            LOG.error("failed to execute " + operation, e);
          }
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.