Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
th0br0 committed Oct 11, 2018
1 parent 43af2e4 commit 0f2739b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Expand Up @@ -47,7 +47,6 @@
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.rpc.Code;
import io.grpc.Status;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -653,7 +652,6 @@ protected boolean isComplete(Operation operation) {
}

abstract protected boolean matchOperation(Operation operation);

abstract protected void enqueueOperation(Operation operation);

@Override
Expand Down Expand Up @@ -710,9 +708,7 @@ public Operation getOperation(String name) {
}

protected abstract int getListOperationsDefaultPageSize();

protected abstract int getListOperationsMaxPageSize();

protected abstract TokenizableIterator<Operation> createOperationsIterator(String pageToken);

@Override
Expand Down Expand Up @@ -784,10 +780,7 @@ public boolean requeueOperation(Operation operation) throws InterruptedException
protected void errorOperation(String name, com.google.rpc.Status status) throws InterruptedException {
Operation operation = getOperation(name);
if (operation == null) {
// throw new IllegalStateException("Trying to error nonexistent operation [" + name + "]");
operation = Operation.newBuilder()
.setName(name)
.build();
throw new IllegalStateException("Trying to error nonexistent operation [" + name + "]");
}
if (operation.getDone()) {
throw new IllegalStateException("Trying to error already completed operation [" + name + "]");
Expand Down
Expand Up @@ -47,11 +47,9 @@
import com.google.protobuf.Any;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.util.Durations;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;

import com.google.rpc.Code;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -82,7 +80,7 @@ public void setUp() throws Exception {
.hashKeys()
.hashSetValues(/* expectedValuesPerKey=*/ 1)
.build());
watchersThreadPool =newFixedThreadPool(1);
watchersThreadPool = newFixedThreadPool(1);
MemoryInstanceConfig memoryInstanceConfig = MemoryInstanceConfig.newBuilder()
.setListOperationsDefaultPageSize(1024)
.setListOperationsMaxPageSize(16384)
Expand Down Expand Up @@ -311,11 +309,7 @@ public void requeueFailOnNotQueued() throws InterruptedException, InvalidProtoco
assertThat(e.getMessage()).isEqualTo("Operation stage is not QUEUED");
}

try {
instance.requeueOperation(queuedOperation);
} catch (IllegalStateException e) {
fail("Method should not throw if operation is QUEUED.");
}
instance.requeueOperation(queuedOperation);
}

private Operation createOperation(String name, Stage stage) {
Expand Down

0 comments on commit 0f2739b

Please sign in to comment.