@ Override public void close ( ) { log . debug ( "close" ) ; // spawn a thread to finish up our flv writer work boolean locked = false ; try { // try to get a lock within x time locked = lock . tryAcquire ( 500L , TimeUnit . MILLISECONDS ) ; if ( locked ) { finalizeFlv ( ) ; } } catch ( InterruptedException e ) { log . warn ( "Exception acquiring lock" , e ) ; } finally { if ( locked ) { lock . release ( ) ; } if ( executor != null && ! executor . isTerminated ( ) ) { executor . shutdown ( ) ; } } }
Ends the writing process then merges the data file with the flv file header and metadata .