question: public static boolean isUsableConnection ( Connection C ) { boolean open = false , valid = false ; final int timeoutSeconds = MAX_CONNECTION_PROBE_TIME ; logger . trace ( "isUsableConnection() -->entry" ) ; if ( C == null ) { logger . error ( "isUsableConnection() <-- exit (No Connection)" ) ; return false ; } try { open = ! C . isClosed ( ) ; } catch ( Throwable t ) { surfaceThrowable ( "isUsableConnection called Connection.isClosed()" , t ) ; } try { valid = C . isValid ( timeoutSeconds ) ; } catch ( Throwable t ) { surfaceThrowable ( "isUsableConnection called isValid()" , t ) ; } logger . trace ( String . format ( "isUsableConnection() <-- exit (Connection is open: %b, is valid: %b)" , open , valid ) ) ; return open && valid ; }
target:  Method to deal with the set of connectivity issues introduced by our penchant for restarting Derby independent of other processes.  The Connection.isValid() method takes a timeout value in units==seconds, which apparently gives us control over how patient we wish to be (as it probes?).  We have chosen an arbitrary value for this.