// If there is a exactly one of each of RemoteGrpcPortWriteOperation and
// RegisterAndProcessBundleOperation we know they have the right topology.
private ProgressTracker createProgressTracker() {
    ReadOperation readOperation;
    RemoteGrpcPortWriteOperation grpcWriteOperation;
    RegisterAndProcessBundleOperation bundleProcessOperation;
    try {
      readOperation = getReadOperation();
    } catch (Exception exn) {
      readOperation = null;
      LOG.info("Unable to get read operation.", exn);
      return new NullProgressTracker();
    }
    // If there is a exactly one of each of RemoteGrpcPortWriteOperation and
    // RegisterAndProcessBundleOperation we know they have the right topology.
    try {
      grpcWriteOperation =
          Iterables.getOnlyElement(
              Iterables.filter(operations, RemoteGrpcPortWriteOperation.class));
      bundleProcessOperation =
          Iterables.getOnlyElement(
              Iterables.filter(operations, RegisterAndProcessBundleOperation.class));
    } catch (IllegalArgumentException | NoSuchElementException exn) {
      // TODO: Handle more than one sdk worker processing a single bundle.
      grpcWriteOperation = null;
      bundleProcessOperation = null;
      LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn);
    }
    if (grpcWriteOperation != null && bundleProcessOperation != null) {
      return new SingularProcessBundleProgressTracker(
          readOperation, grpcWriteOperation, bundleProcessOperation);
    } else {
      return new ReadOperationProgressTracker(readOperation);
    }
  }
return new NullProgressTracker();
}
// If there is a exactly one of each of RemoteGrpcPortWriteOperation and
// RegisterAndProcessBundleOperation we know they have the right topology.
try {
grpcWriteOperation =
ReadOperation readOperation;
RemoteGrpcPortWriteOperation grpcWriteOperation;
RegisterAndProcessBundleOperation bundleProcessOperation;
try {
readOperation = getReadOperation();
} catch (Exception exn) {
readOperation = null;
LOG.info("Unable to get read operation.", exn);
return new NullProgressTracker();
}
// If there is a exactly one of each of RemoteGrpcPortWriteOperation and
// RegisterAndProcessBundleOperation we know they have the right topology.
try {
grpcWriteOperation =
Iterables.getOnlyElement(
Iterables.filter(operations, RemoteGrpcPortWriteOperation.class));
bundleProcessOperation =
Iterables.getOnlyElement(
Iterables.filter(operations, RegisterAndProcessBundleOperation.class));
} catch (IllegalArgumentException | NoSuchElementException exn) {
// TODO: Handle more than one sdk worker processing a single bundle.
grpcWriteOperation = null;
private ProgressTracker createProgressTracker() {
ReadOperation readOperation;
RemoteGrpcPortWriteOperation grpcWriteOperation;
RegisterAndProcessBundleOperation bundleProcessOperation;
try {
readOperation = getReadOperation();
} catch (Exception exn) {
readOperation = null;
LOG.info("Unable to get read operation.", exn);
return new NullProgressTracker();
}
// If there is a exactly one of each of RemoteGrpcPortWriteOperation and
// RegisterAndProcessBundleOperation we know they have the right topology.
try {
grpcWriteOperation =
Iterables.getOnlyElement(
Iterables.filter(operations, RemoteGrpcPortWriteOperation.class));
bundleProcessOperation =
Iterables.getOnlyElement(
Iterables.filter(operations, RegisterAndProcessBundleOperation.class));
} catch (IllegalArgumentException | NoSuchElementException exn) {
// TODO: Handle more than one sdk worker processing a single bundle.
grpcWriteOperation = null;
bundleProcessOperation = null;
LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn);
}
if (grpcWriteOperation != null && bundleProcessOperation != null) {
return new SingularProcessBundleProgressTracker(
readOperation, grpcWriteOperation, bundleProcessOperation);
} else {
return new ReadOperationProgressTracker(readOperation);
}
}