public static void parseDurationProperties ( Map < String , Object > vendorProps , String className , ConnectorService connectorSvc ) throws Exception { // type=long, unit=milliseconds for ( String propName : PropertyService . DURATION_MS_LONG_PROPS ) { Object propValue = vendorProps . remove ( propName ) ; if ( propValue != null ) try { vendorProps . put ( propName , MetatypeUtils . evaluateDuration ( ( String ) propValue , TimeUnit . MILLISECONDS ) ) ; } catch ( Exception x ) { x = connectorSvc . ignoreWarnOrFail ( tc , x , x . getClass ( ) , "UNSUPPORTED_VALUE_J2CA8011" , propValue , propName , className ) ; if ( x != null ) throw x ; } } // type=int, unit=milliseconds for ( String propName : PropertyService . DURATION_MS_INT_PROPS ) { Object propValue = vendorProps . remove ( propName ) ; if ( propValue != null ) try { vendorProps . put ( propName , MetatypeUtils . evaluateDuration ( ( String ) propValue , TimeUnit . MILLISECONDS ) . intValue ( ) ) ; } catch ( Exception x ) { x = connectorSvc . ignoreWarnOrFail ( tc , x , x . getClass ( ) , "UNSUPPORTED_VALUE_J2CA8011" , propValue , propName , className ) ; if ( x != null ) throw x ; } } // type=int, unit=seconds for ( String propName : PropertyService . DURATION_S_INT_PROPS ) { Object propValue = vendorProps . remove ( propName ) ; if ( propValue != null ) if ( propValue instanceof String ) try { vendorProps . put ( propName , MetatypeUtils . evaluateDuration ( ( String ) propValue , TimeUnit . SECONDS ) . intValue ( ) ) ; } catch ( Exception x ) { x = connectorSvc . ignoreWarnOrFail ( tc , x , x . getClass ( ) , "UNSUPPORTED_VALUE_J2CA8011" , propValue , propName , className ) ; if ( x != null ) throw x ; } else // loginTimeout is already converted to int vendorProps . put ( propName , propValue ) ; } // lockTimeout has different type/units between Microsoft and DB2 i Object lockTimeout = vendorProps . remove ( "lockTimeout" ) ; if ( lockTimeout != null ) try { if ( className . startsWith ( "com.microsoft" ) ) vendorProps . put ( "lockTimeout" , MetatypeUtils . evaluateDuration ( ( String ) lockTimeout , TimeUnit . MILLISECONDS ) ) ; else vendorProps . put ( "lockTimeout" , MetatypeUtils . evaluateDuration ( ( String ) lockTimeout , TimeUnit . SECONDS ) . intValue ( ) ) ; } catch ( Exception x ) { x = connectorSvc . ignoreWarnOrFail ( tc , x , x . getClass ( ) , "UNSUPPORTED_VALUE_J2CA8011" , lockTimeout , "lockTimeout" , className ) ; if ( x != null ) throw x ; } }
Parse and convert duration type properties .