public void add ( String instanceId ) { ScheduledFuture task = this . scheduler . scheduleAtFixedRate ( new ConsulHeartbeatTask ( instanceId ) , this . configuration . computeHearbeatInterval ( ) . toStandardDuration ( ) . getMillis ( ) ) ; ScheduledFuture previousTask = this . serviceHeartbeats . put ( instanceId , task ) ; if ( previousTask != null ) { previousTask . cancel ( true ) ; } }
Add a service to the checks loop .