protected void incrementFatalErrorValue ( int value1 ) { /* * value1 and value2 are index values for the free pools. * When value1 and value2 are 0, we are in free pool . */ if ( fatalErrorNotificationTime == Integer . MAX_VALUE - 1 ) { /* * We need to start over at zero. All connection * fatal error values need to be reset to zero. */ fatalErrorNotificationTime = 0 ; if ( value1 == 0 ) { /* * We only want to do this once. When the values value1 and value2 are 0 * are are processing the first free pool. When we are processing all of the * rest of the free pool, this code will not be executed. */ pm . mcToMCWMapWrite . lock ( ) ; try { Collection < MCWrapper > mcWrappers = pm . mcToMCWMap . values ( ) ; Iterator < MCWrapper > mcWrapperIt = mcWrappers . iterator ( ) ; while ( mcWrapperIt . hasNext ( ) ) { MCWrapper mcw = mcWrapperIt . next ( ) ; if ( ! mcw . isParkedWrapper ( ) ) { /* * Reset the fatal error value to zero. * This connection will be cleaned up and * destroyed when returned to the free pool. */ mcw . setFatalErrorValue ( 0 ) ; } } } finally { pm . mcToMCWMapWrite . unlock ( ) ; } } } else { ++ fatalErrorNotificationTime ; } }
This method should only be called when a fatal error occurs or when an attempt is made to remove all of the connections from the pool .