private void scheduleTasks ( ) { int rhDelay = getServiceDirectoryConfig ( ) . getInt ( SD_API_REGISTRY_HEALTH_CHECK_DELAY_PROPERTY , SD_API_REGISTRY_HEALTH_CHECK_DELAY_DEFAULT ) ; int rhInterval = getServiceDirectoryConfig ( ) . getInt ( SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_PROPERTY , SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_DEFAULT ) ; LOGGER . info ( "Start the SD API RegistryHealth Task scheduler, delay={}, interval={}." , rhDelay , rhInterval ) ; healthCheckService . get ( ) . scheduleAtFixedRate ( new HealthCheckTask ( ) , rhDelay , rhInterval , TimeUnit . SECONDS ) ; int hbDelay = getServiceDirectoryConfig ( ) . getInt ( SD_API_HEARTBEAT_DELAY_PROPERTY , SD_API_HEARTBEAT_DELAY_DEFAULT ) ; int hbInterval = getServiceDirectoryConfig ( ) . getInt ( SD_API_HEARTBEAT_INTERVAL_PROPERTY , SD_API_HEARTBEAT_INTERVAL_DEFAULT ) ; LOGGER . info ( "Start the SD API Heartbeat Task scheduler, delay={}, interval={}." , hbDelay , hbInterval ) ; heartbeatService . get ( ) . scheduleAtFixedRate ( new HeartbeatTask ( ) , hbDelay , hbInterval , TimeUnit . SECONDS ) ; }
schedule the Heartbeat task and Health Check task .