@Test public void commutativeNewUpdatesSingleBuilder() { Status newFile = StatusUtil.fileCreated(100), firstSync = StatusUtil.ingestedUntil(builder, 100), secondSync = StatusUtil.ingestedUntil(builder, 200); Status order1 = combiner.typedReduce(key, Arrays.asList(newFile, firstSync, secondSync).iterator()), order2 = combiner.typedReduce(key, Arrays.asList(newFile, secondSync, firstSync).iterator()); assertEquals(order1, order2); }
@Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); } }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override Status typedReduce(Key key, Iterator<Status> iter); void combine(Builder combined, Status status); }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override Status typedReduce(Key key, Iterator<Status> iter); void combine(Builder combined, Status status);  }