/** * Updates the contents of this handle with information from the given one. * * @param source The RollingSegmentHandle to update from. */ synchronized void refresh(RollingSegmentHandle source) { Preconditions.checkArgument(source.getSegmentName().equals(this.getSegmentName()), "SegmentName mismatch."); if (this.readOnly == source.readOnly) { // Update the header handle, but only if both this handle and the source one have the same read-only flag. // Otherwise we risk attaching a read-only header handle to a read-write handle or vice-versa. this.headerHandle = source.headerHandle; } this.segmentChunks = new ArrayList<>(source.chunks()); setHeaderLength(source.getHeaderLength()); if (source.isSealed()) { markSealed(); } if (source.isDeleted()) { markDeleted(); } }
this.baseStorage.delete(subHandle); h.lastChunk().markInexistent(); h.markDeleted(); } catch (StreamSegmentNotExistsException ex) { h.lastChunk().markInexistent(); h.markDeleted(); throw ex; try { this.baseStorage.delete(headerHandle); h.markDeleted(); } catch (StreamSegmentNotExistsException ex) { h.markDeleted(); throw ex;
h.markDeleted(); Assert.assertTrue("Unexpected value for isDeleted.", h.isDeleted());