public static org . ironjacamar . core . connectionmanager . pool . Capacity create ( org . ironjacamar . common . api . metadata . common . Capacity metadata , ClassLoaderPlugin classLoaderPlugin ) { if ( metadata == null ) return DefaultCapacity . INSTANCE ; CapacityIncrementer incrementer = null ; CapacityDecrementer decrementer = null ; // Incrementer if ( metadata . getIncrementer ( ) != null && metadata . getIncrementer ( ) . getClassName ( ) != null ) { incrementer = loadIncrementer ( metadata . getIncrementer ( ) , classLoaderPlugin ) ; if ( incrementer != null ) { injectProperties ( metadata . getIncrementer ( ) . getConfigPropertiesMap ( ) , incrementer ) ; } else { log . invalidCapacityIncrementer ( metadata . getIncrementer ( ) . getClassName ( ) ) ; } } if ( incrementer == null ) incrementer = DefaultCapacity . DEFAULT_INCREMENTER ; // Decrementer if ( metadata . getDecrementer ( ) != null && metadata . getDecrementer ( ) . getClassName ( ) != null ) { decrementer = loadDecrementer ( metadata . getDecrementer ( ) , classLoaderPlugin ) ; if ( decrementer != null ) { injectProperties ( metadata . getDecrementer ( ) . getConfigPropertiesMap ( ) , decrementer ) ; } else { // Explicit allow TimedOutDecrementer, MinPoolSizeDecrementer and SizeDecrementer for CRI based pools if ( TimedOutDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || TimedOutFIFODecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || MinPoolSizeDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) || SizeDecrementer . class . getName ( ) . equals ( metadata . getDecrementer ( ) . getClassName ( ) ) ) { decrementer = loadDecrementer ( metadata . getDecrementer ( ) , classLoaderPlugin ) ; injectProperties ( metadata . getDecrementer ( ) . getConfigPropertiesMap ( ) , decrementer ) ; } else { log . invalidCapacityDecrementer ( metadata . getDecrementer ( ) . getClassName ( ) ) ; } } } if ( decrementer == null ) decrementer = DefaultCapacity . DEFAULT_DECREMENTER ; return new ExplicitCapacity ( incrementer , decrementer ) ; }
Create a capacity instance based on the metadata