Package net.sf.katta.operation.node

Examples of net.sf.katta.operation.node.NodeOperation.execute()


          try {
            NodeOperation operation = _queue.peek();
            OperationResult operationResult;
            try {
              LOG.info("executing " + operation);
              operationResult = operation.execute(_nodeContext);
            } catch (Exception e) {
              ExceptionUtil.rethrowInterruptedException(e);
              LOG.error(_nodeContext.getNode().getName() + ": failed to execute " + operation, e);
              operationResult = new OperationResult(_nodeContext.getNode().getName(), e);
            }
View Full Code Here


  @Test(timeout = 10000)
  public void testInterruptedException_Operation() throws Exception {
    NodeOperation nodeOperation = mock(NodeOperation.class);
    when(_queue.peek()).thenReturn(nodeOperation);
    when(nodeOperation.execute(_context)).thenThrow(new InterruptedException());
    _processor.run();
  }

  @Test(timeout = 10000)
  public void testInterruptedException_Operation_ZK() throws Exception {
View Full Code Here

  @Test(timeout = 10000)
  public void testInterruptedException_Operation_ZK() throws Exception {
    NodeOperation nodeOperation = mock(NodeOperation.class);
    when(_queue.peek()).thenReturn(nodeOperation);
    when(nodeOperation.execute(_context)).thenThrow(new ZkInterruptedException(new InterruptedException()));
    _processor.run();
  }

  @Test(timeout = 10000)
  public void testDontStopOnOOM() throws Exception {
View Full Code Here

    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
View Full Code Here

    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
View Full Code Here

    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
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.