question: private boolean validateCooldownSetting ( String appId , AutoScalerPolicyTrigger policyTrigger , String triggerId ) { AutoScalingDataStore stateStore = AutoScalingDataStoreFactory . getAutoScalingDataStore ( ) ; AppAutoScaleState appState = null ; appState = stateStore . getScalingState ( appId ) ; if ( appState == null ) { return true ; } else if ( ( appState . getInstanceCountState ( ) != ScalingStateManager . SCALING_STATE_COMPLETED ) && ( appState . getInstanceCountState ( ) != ScalingStateManager . SCALING_STATE_FAILED ) ) { long lastStartTime = appState . getLastActionStartTime ( ) ; long currentTime = System . currentTimeMillis ( ) ; boolean timeExpired = ( currentTime - lastStartTime ) > this . eventTimeout ; if ( timeExpired ) { logger . debug ( "True: Last scaling action is not completed but it's time expired for application " + appId + "." ) ; return true ; } logger . debug ( "False: Last scaling action is not completed for application " + appId + "." ) ; return false ; } else { long cooldownEndtime = appState . getLastActionEndTime ( ) + 1000L * getCooldownSecs ( policyTrigger , triggerId ) ; if ( System . currentTimeMillis ( ) < cooldownEndtime ) { logger . debug ( "False: It's cooldown time for application " + appId + ". No scaling in action." ) ; return false ; } } return true ; }
target:  Checks if the app should be scaled in/out according to cooldown settings