Called once at the start of the simulation.

@param when Time when the task tracker starts.
@return the initial HeartbeatEvent for ourselves.
490803
public List<SimulatorEvent> init(long when) {
    LOG.debug("TaskTracker starting up, current simulation time=" + when);

    return Collections.<SimulatorEvent>singletonList(new HeartbeatEvent(this, when));  
  }
56373
public void setHeartbeatInterval(short heartbeatInterval)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setHeartbeatInterval");
      properties.put(HEARTBEAT_INTERVAL, heartbeatInterval);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setHeartbeatInterval", ""+heartbeatInterval);
   }
1128979
private int determineHeartbeatInterval(Map properties) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "determineHeartbeatInterval", properties);

        // How often should we heartbeat?
        int heartbeatInterval = JFapChannelConstants.DEFAULT_HEARTBEAT_INTERVAL;
        try {
            //669424: using RuntimeInfo.getPropertyWithMsg as this would log a message
            // when the property is different to the default value passed.
            heartbeatInterval = Integer.parseInt(RuntimeInfo.getPropertyWithMsg(JFapChannelConstants.RUNTIMEINFO_KEY_HEARTBEAT_INTERVAL, "" + heartbeatInterval));
        } catch (NumberFormatException nfe) {
            // No FFDC code needed
        }

        if (properties != null) {
            String intervalStr = (String) properties.get(JFapChannelConstants.CHANNEL_CONFIG_HEARTBEAT_INTERVAL_PROPERTY);
            if (intervalStr != null) {
                try {
                    heartbeatInterval = Integer.parseInt(intervalStr);
                } catch (NumberFormatException nfe) {
                    // No FFDC code needed
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "determineHeartbeatInterval", heartbeatInterval);

        return heartbeatInterval;
    }
1275574
private void heartbeat() {
    long index = context.nextIndex();
    long timestamp = System.currentTimeMillis();
    replicator.replicate(new HeartbeatOperation(index, timestamp))
        .thenRun(() -> context.setTimestamp(timestamp));
  }
86667
private int determineHeartbeatInterval(Map properties)
    {
        // How often should we heartbeat?
        int heartbeatInterval = JFapChannelConstants.DEFAULT_HEARTBEAT_INTERVAL;
        try
        {
            heartbeatInterval = Integer.parseInt(RuntimeInfo.getProperty(JFapChannelConstants.RUNTIMEINFO_KEY_HEARTBEAT_INTERVAL, "" + heartbeatInterval));
        } catch (NumberFormatException nfe)
        {
            // No FFDC code needed
        }

        if (properties != null)
        {
            String intervalStr = (String) properties.get(JFapChannelConstants.CHANNEL_CONFIG_HEARTBEAT_INTERVAL_PROPERTY);
            if (intervalStr != null)
            {
                try
                {
                    heartbeatInterval = Integer.parseInt(intervalStr);
                } catch (NumberFormatException nfe)
                {
                    // No FFDC code needed
                }
            }
        }
        return heartbeatInterval;
    }
1168371
public void onStartup() throws StartupException {
        if (monitor == null) {
            monitor = this;
            thread = new Thread() {
                @Override
                public void run() {
                    this.setName("UserGroupMonitor-thread");
                    monitor.start();
                }
            };
            thread.start();
        }
    }
1306580
public synchronized Instant getStartTime(TimestampProvider times) {
        if (startTime==null) {
            startTime = times.getTime();
        }
        return startTime;
    }
940410
@Override
    public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
        long initialDelay = startTime.getTime() - System.currentTimeMillis();
        try {
            return this.scheduledExecutor.schedule(decorateTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task,
                    ex);
        }
    }
442296
@Override
  public List<SimulatorEvent> accept(SimulatorEvent event) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Accepted event " + event);
    }

    if (event instanceof HeartbeatEvent) {
      return processHeartbeatEvent((HeartbeatEvent)event);
    } else if (event instanceof TaskAttemptCompletionEvent) {
      return processTaskAttemptCompletionEvent((TaskAttemptCompletionEvent)
                                               event);
    } else {
      throw new IllegalArgumentException("Unhandled event "+event);
    }
  }
528759
public static WatchMonitor create(String path, WatchEvent.Kind<?>... events){
		return create(path, 0, events);
	}
1212216
@Override
  synchronized boolean processHeartbeat(TaskTrackerStatus trackerStatus,
      boolean initialContact) {
    boolean loggingEnabled = LOG.isDebugEnabled();
    String trackerName = trackerStatus.getTrackerName();
    boolean seenBefore = updateTaskTrackerStatus(trackerName, trackerStatus);
    TaskTracker taskTracker = getTaskTracker(trackerName);
    // update the status of the task tracker. Also updates all aggregate
    // statistics
    if (loggingEnabled) {
      LOG.debug("processing heartbeat for " + trackerName);
      LOG.debug("updating TaskTracker status for " + trackerName);
    }
    if (initialContact) {
      // If it's first contact, then clear out 
      // any state hanging around
      if (seenBefore) {
        lostTaskTracker(taskTracker);
      }
    } else {
      // If not first contact, there should be some record of the tracker
      if (!seenBefore) {
        LOG.warn("Status from unknown Tracker : " + trackerName);
        updateTaskTrackerStatus(trackerName, null);
        return false;
      }
    }

    if (initialContact) {
      if (loggingEnabled) {
        LOG.debug("adding new tracker name = " + trackerName);
      }
      addNewTracker(taskTracker);
    }

    if (loggingEnabled) {
      LOG.debug("updating TaskStatus for " + trackerName);
    }
    // update status of all tasks from heartbeat
    updateTaskStatuses(trackerStatus);

    return true;
  }
215978
public TimerType<T> start(java.util.Date start)
   {
      if (start != null)
      {
         childNode.getOrCreate("start").text(XMLDate.toXMLFormat(start));
         return this;
      }
      return null;
   }
503907
public final void mWHEN() throws RecognitionException {
		try {
			int _type = WHEN;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:70:6: ( 'when' )
			// hql.g:70:8: 'when'
			{
			match("when"); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
261755
synchronized boolean processHeartbeat(
                                 TaskTrackerStatus trackerStatus,
                                 boolean initialContact) {
    String trackerName = trackerStatus.getTrackerName();

    synchronized (taskTrackers) {
      synchronized (trackerExpiryQueue) {
        boolean seenBefore = updateTaskTrackerStatus(trackerName,
                                                     trackerStatus);
        TaskTracker taskTracker = getTaskTracker(trackerName);
        if (initialContact) {
          // If it's first contact, then clear out
          // any state hanging around
          if (seenBefore) {
            LOG.warn("initialContact but seenBefore from Tracker : " + trackerName);
            lostTaskTracker(taskTracker);
          }
        } else {
          // If not first contact, there should be some record of the tracker
          if (!seenBefore) {
            LOG.warn("Status from unknown Tracker : " + trackerName);
            updateTaskTrackerStatus(trackerName, null);
            return false;
          }
        }

        if (initialContact) {
          // if this is lost tracker that came back now, and if it blacklisted
          // increment the count of blacklisted trackers in the cluster
          if (isBlacklisted(trackerName)) {
            faultyTrackers.incrBlackListedTrackers(1);
          }
          addNewTracker(taskTracker);
        }
      }
    }

    updateTaskStatuses(trackerStatus);
    updateNodeHealthStatus(trackerStatus);

    return true;
  }
94272
public TimeCounter start() {
        switch (state) {
            case UNSTARTED:
                watch.start();
                break;
            case RUNNING:
                throw new IllegalStateException("Already started. ");
            case STOPPED:
                watch.resume();
        }
        state = State.RUNNING;
        return this;
    }
914394
private synchronized void sendHeartBeat(
      final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto heartbeatProto) {
    if (LOG.isLoggable(Level.FINEST)) {
      LOG.log(Level.FINEST, "Heartbeat message:\n" + heartbeatProto, new Exception("Stack trace"));
    }
    this.evaluatorHeartbeatHandler.onNext(heartbeatProto);
  }
534326
def before_start(self, when=None):
        
        if when is None:
            when = datetime.now()

        return self._val[0] > when