Set heartbeat fails. Defines how many times can the client fail the heartbeat.

@param newHeartbeatTime
187006
public void setHeartbeatTime(int newHeartbeatTime) {
		if (newHeartbeatTime > 0) {
			if (newHeartbeatTime > heartbeatMaxTime
					|| newHeartbeatTime < heartbeatMinTime) {
				raiseOrtcEvent(EventEnum.OnException, this, new Exception(
						"Heartbeat time is out of limits - Min: "
								+ heartbeatMinTime + " | Max: "
								+ heartbeatMaxTime));
			} else {
				heartbeatTime = newHeartbeatTime;
			}
		} else {
			raiseOrtcEvent(EventEnum.OnException, this, new Exception(
					"Invalid heartbeat time " + newHeartbeatTime));
		}
	}
661995
protected void startHeartbeatForThisSession()
  {
    if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
    {
      logger.debug("start heartbeat, master token validity: " +
                   masterTokenValidityInSeconds);

      HeartbeatBackground.getInstance().addSession(this,
                                                   masterTokenValidityInSeconds, this.heartbeatFrequency);
    }
    else
    {
      logger.debug("heartbeat not enabled for the session");
    }
  }
5357
private void runHeartbeatLoop() {
		final long interval = GlobalConfiguration.getInteger(
						ConfigConstants.TASK_MANAGER_HEARTBEAT_INTERVAL_KEY,
						ConfigConstants.DEFAULT_TASK_MANAGER_HEARTBEAT_INTERVAL);

		while (!shutdownStarted.get()) {
			// send heart beat
			try {
				LOG.debug("heartbeat");
				this.jobManager.sendHeartbeat(this.localInstanceConnectionInfo, this.hardwareDescription);
			} catch (IOException e) {
				if (shutdownStarted.get()) {
					break;
				} else {
					LOG.error("Sending the heart beat caused an exception: " + e.getMessage(), e);
				}
			}
			
			// sleep until the next heart beat
			try {
				Thread.sleep(interval);
			}
			catch (InterruptedException e) {
				if (!shutdownStarted.get()) {
					LOG.error("TaskManager heart beat loop was interrupted without shutdown.");
				}
			}
		}
	}
1203799
public SwimMembershipProtocolConfig setFailureTimeout(Duration failureTimeout) {
    checkNotNull(failureTimeout, "failureTimeout cannot be null");
    checkArgument(!failureTimeout.isNegative() && !failureTimeout.isZero(), "failureTimeout must be positive");
    this.failureTimeout = checkNotNull(failureTimeout);
    return this;
  }
308747
function () {
        stopHeartBeatInterval(ortc);

        reconnectStartedAt = null;
        isConnected = false;
        isConnecting = false;
        validatedArrived = false;
        retryingWithSsl = false;        

        clearValidatedTimeout(self);

        if (ortc.sockjs != null) {
            ortc.sockjs.close();
            ortc.sockjs = null;
        }
    }
315864
@Override
  public void failConnect(long time)
  {
    getConnectionFailProbe().start();

    _failCountTotal.incrementAndGet();
    
    logFinest(L.l("failConnect: time={0}, _failTime={1}",
                  time, _failTime));

    synchronized (this) {
      if (_failTime < time) {
        degrade(time);
        
        _firstSuccessTime = 0;
        _failTime = time;
        _lastFailTime = time;
        _lastFailConnectTime = time;
        
        _dynamicFailRecoverTime *= 2;
        if (_loadBalanceFailRecoverTime < _dynamicFailRecoverTime)
          _dynamicFailRecoverTime = _loadBalanceFailRecoverTime;
  
        _state = _state.toFail();
      }
    }
  }
751216
void clusterHeartbeat(String clusterId,
                        UpdateServerHeartbeat updateSelf,
                        UpdateRackHeartbeat updateRack,
                        UpdatePodSystem updatePod,
                        long sequence)
  {
    if (startUpdate(updateRack, updatePod)) {
      getHeartbeat().clusterHeartbeat(clusterId, updateSelf, updateRack, updatePod, sequence);
    }
  }
657785
boolean onHeartbeatStop()
  {
    SocketPool clusterSocketPool;
    
    if (isExternal()) {
      clusterSocketPool = _clusterSocketPool.getAndSet(null);
    }
    else {
      clusterSocketPool = _clusterSocketPool.get();
    }

    if (clusterSocketPool != null) {
      clusterSocketPool.getFactory().notifyHeartbeatStop();
    }

    /*
    if (! _heartbeatState.notifyHeartbeatStop()) {
      return false;
    }
    */
    
    log.fine("notify-heartbeat-stop " + this);

    return true;
  }
465091
@Override
  public void notifyFailure(Set<String> errorProcessNames) {
    if (errorProcessNames != null) {
      LOG.warn("Missing pings from : " + errorProcessNames.toString());
    } else {
      LOG.warn("No heartbeats registered");
    }
    healthInspector.stopAndWait();
    healthInspector = new HealthInspector(this);
    inputFlowletService.restartService(healthInspector);
    healthInspector.startAndWait();
  }
628270
private void checkHeartbeatTimeout(PropertyKey intervalKey, PropertyKey timeoutKey) {
    long interval = getMs(intervalKey);
    long timeout = getMs(timeoutKey);
    Preconditions.checkState(interval < timeout,
        "heartbeat interval (%s=%s) must be less than heartbeat timeout (%s=%s)", intervalKey,
        interval, timeoutKey, timeout);
  }
348296
private void scheduleHeartbeat()
  {
    // elapsed time in seconds since the last heartbeat
    long elapsedSecsSinceLastHeartBeat =
        System.currentTimeMillis() / 1000 - lastHeartbeatStartTimeInSecs;

    /*
     * The initial delay for the new scheduling is 0 if the elapsed
     * time is more than the heartbeat time interval, otherwise it is the
     * difference between the heartbeat time interval and the elapsed time.
     */
    long initialDelay = Math.max(heartBeatIntervalInSecs -
                                 elapsedSecsSinceLastHeartBeat, 0);

    LOGGER.debug(
        "schedule heartbeat task with initial delay of {} seconds",
        initialDelay);

    // Creates and executes a periodic action to send heartbeats
    this.heartbeatFuture =
        this.scheduler.schedule(this, initialDelay, TimeUnit.SECONDS);
  }
254306
public String performLcdsHeartBeat(long accountId, String sessionToken, int heartBeatCount, Date date) {
        return client.sendRpcAndWait(SERVICE, "performLCDSHeartBeat", accountId, sessionToken, heartBeatCount, format.format(date));
    }
801174
public void doHeartbeat() throws IOException {
        int curTime = TimeUtils.current_time_secs();
        WorkerHeartbeat hb = new WorkerHeartbeat(curTime, topologyId, taskIds, port);

        LOG.debug("Doing heartbeat:" + workerId + ",port:" + port + ",hb" + hb.toString());
        LocalState state = getWorkerState();
        state.put(Common.LS_WORKER_HEARTBEAT, hb);
    }
945443
@Override
    protected void checkIfHeartbeatSkipped(String name, EventChannelStruct channelStruct) {
            // Check if heartbeat have been skipped, can happen if
            // 1- the server is dead
            // 2- The network was down;
            // 3- The server has been restarted on another host.

        if (KeepAliveThread.heartbeatHasBeenSkipped(channelStruct)) {
            DevError    dev_error = null;
            try{
                String  admDeviceName = channelStruct.adm_device_proxy.fullName();  //.toLowerCase();
                //  Since Tango 8.1, heartbeat is sent in lower case.
                if (channelStruct.getTangoRelease()>=810)
                    admDeviceName = admDeviceName.toLowerCase();
                channelStruct.adm_device_proxy = new DeviceProxy(admDeviceName);
                channelStruct.adm_device_proxy.set_timeout_millis(300);
                channelStruct.adm_device_proxy.ping();
                reconnectToChannel(name);
            }
            catch (DevFailed e) {
                dev_error = e.errors[0];
            }

            Enumeration callbackStructs = EventConsumer.getEventCallbackMap().elements();
            while (callbackStructs.hasMoreElements()) {
                EventCallBackStruct callbackStruct = (EventCallBackStruct) callbackStructs.nextElement();
                if (callbackStruct.channel_name.equals(name)) {
                    //	Push exception
                    if (dev_error != null)
                        pushReceivedException(channelStruct, callbackStruct, dev_error);
                    else {
                        //  ToDo Re connect without error means heartbeat missing
                        dev_error = new DevError("API_NoHeartbeat",
                                ErrSeverity.ERR, "No heartbeat from " +
                                    channelStruct.adm_device_proxy.get_name(),
                                "ZmqEventConsumer.checkIfHeartbeatSkipped()");
                        pushReceivedException(channelStruct, callbackStruct, dev_error);
                    }

                    //	If reconnection done, try to re subscribe
                    //		and read attribute in synchronous mode
                    if (reconnectToEvent(channelStruct, callbackStruct)) {
                        if (!callbackStruct.event_name.equals(eventNames[DATA_READY_EVENT])) {
                            readAttributeAndPush(channelStruct, callbackStruct);
                        }
                    }
                }
            }
        }
    }
1251525
@Subscribe
  public void slowHeartBeat(LowLevelHeartBeatEvent e) {
    Description current = null;
    if (tests != null && !tests.isEmpty()) {
      current = tests.peek().getDescription();
    } else {
      current = lastSuite; // may be null.
    }

    target.post(new HeartBeatEvent(
        slave,
        current,
        e.lastActivity,
        e.currentTime
    ));
  }
544799
@Override
	public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) {
		if (!stopped) {
			log.debug("Received heartbeat from {}.", heartbeatOrigin);
			reportHeartbeat(heartbeatOrigin);

			if (heartbeatPayload != null) {
				heartbeatListener.reportPayload(heartbeatOrigin, heartbeatPayload);
			}
		}
	}
584769
public void onFail()
  {
    _lastFailTime = CurrentTime.currentTime();
    
    if (_firstFailTime == 0) {
      _firstFailTime = _lastFailTime;
    }
    _firstSuccessTime = 0;
    
    toState(State.FAIL);
    
    long recoverTimeout = _dynamicRecoverTimeout.get();
    
    long nextRecoverTimeout = Math.min(recoverTimeout + 1000L, _recoverTimeout);
    
    _dynamicRecoverTimeout.compareAndSet(recoverTimeout, nextRecoverTimeout);
  }