question: private void awaitRunningTx ( long logTimeout , final TimeUnit unit ) throws InterruptedException { final long begin = System . nanoTime ( ) ; long lastLogTime = begin ; logTimeout = unit . toNanos ( logTimeout ) ; long elapsed = 0L ; if ( log . isInfoEnabled ( ) ) log . info ( "activeCount=" + getActiveCount ( ) ) ; while ( getActiveCount ( ) > 0 ) { if ( txDeactivate . await ( logTimeout , TimeUnit . NANOSECONDS ) && getActiveCount ( ) == 0 ) { elapsed = System . nanoTime ( ) - begin ; if ( log . isInfoEnabled ( ) ) log . info ( "No transactions remaining: elapsed=" + elapsed ) ; return ; } elapsed = System . nanoTime ( ) - begin ; { final long now = System . nanoTime ( ) ; final long elapsedLogTime = now - lastLogTime ; if ( elapsedLogTime >= logTimeout ) { try { logTimeout ( elapsed , TimeUnit . NANOSECONDS ) ; } catch ( Throwable t ) { log . error ( "Ignored" , t ) ; } } lastLogTime = now ; } } }
target:  Wait until active transactions complete.