@Override public SegmentId getId() { return !isClosed() ? baseSegment.getId() : null; }
@Override protected boolean onAdvance(int phase, int registeredParties) { Preconditions.checkState(registeredParties == 0); // Ensure that onAdvance() doesn't throw exception, otherwise termination won't happen try { baseSegment.close(); } catch (Exception e) { try { log.error(e, "Exception while closing segment[%s]", baseSegment.getId()); } catch (Exception e2) { // ignore } } // Always terminate. return true; } };
public void swapSegment(@Nullable Segment newSegment) { while (true) { ReferenceCountingSegment currentSegment = adapter.get(); if (currentSegment == null && newSegment == null) { return; } if (currentSegment != null && newSegment != null && !newSegment.getId().equals(currentSegment.getId())) { // Sanity check: identifier should not change throw new ISE( "WTF?! Cannot swap identifier[%s] -> [%s]!", currentSegment.getId(), newSegment.getId() ); } if (currentSegment == newSegment) { throw new ISE("Cannot swap to the same segment"); } ReferenceCountingSegment newReferenceCountingSegment = newSegment != null ? new ReferenceCountingSegment(newSegment) : null; if (adapter.compareAndSet(currentSegment, newReferenceCountingSegment)) { if (currentSegment != null) { currentSegment.close(); } index = null; return; } } }
Preconditions.checkArgument(intervals.size() == 1, "Can only handle a single interval, got[%s]", intervals); final SegmentId segmentId = segment.getId();
Collections.singletonList( new SegmentAnalysis( segment.getId().toString(), retIntervals, columns,
final String segmentId = segment.getId().withInterval(intervals.get(0)).toString();