public long getSecondsUntilExpiry ( Sha256Hash id ) { lock . lock ( ) ; try { final Set < StoredClientChannel > setChannels = mapChannels . get ( id ) ; final long nowSeconds = Utils . currentTimeSeconds ( ) ; int earliestTime = Integer . MAX_VALUE ; for ( StoredClientChannel channel : setChannels ) { synchronized ( channel ) { if ( channel . expiryTimeSeconds ( ) > nowSeconds ) earliestTime = Math . min ( earliestTime , ( int ) channel . expiryTimeSeconds ( ) ) ; } } return earliestTime == Integer . MAX_VALUE ? 0 : earliestTime - nowSeconds ; } finally { lock . unlock ( ) ; } }
Returns the number of seconds from now until this servers next channel will expire or zero if no unexpired channels found .