private CompletableFuture < Void > trySealStreamSegment ( SegmentMetadata metadata , Duration timeout ) { if ( metadata . isSealed ( ) ) { return CompletableFuture . completedFuture ( null ) ; } else { // It is OK to ignore StreamSegmentSealedException as the segment may have already been sealed by a concurrent // call to this or via some other operation. return Futures . exceptionallyExpecting ( this . durableLog . add ( new StreamSegmentSealOperation ( metadata . getId ( ) ) , timeout ) , ex -> ex instanceof StreamSegmentSealedException , null ) ; } }
Attempts to seal a Segment that may already be sealed .