private < R > R execute ( String segmentName , Callable < R > operation ) throws StreamSegmentException { Exceptions . checkNotClosed ( this . closed . get ( ) , this ) ; try { return operation . call ( ) ; } catch ( Exception e ) { return throwException ( segmentName , e ) ; } }
Executes the given Callable and returns its result while translating any Exceptions bubbling out of it into StreamSegmentExceptions .