All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.carrotsearch.ant.tasks.junit4.events.aggregated.HeartBeatEvent Maven / Gradle / Ivy

The newest version!
package com.carrotsearch.ant.tasks.junit4.events.aggregated;

import org.junit.runner.Description;

import com.carrotsearch.ant.tasks.junit4.ForkedJvmInfo;

/**
 * High level heartbeat event issued to report listeners when a forked JVM
 * does not repond for a longer while. The {@link #getDescription} method should
 * return an approximate place where the forked JVM is at the moment, but this is
 * not guaranteed (and may be null).
 */
public final class HeartBeatEvent {
  private final ForkedJvmInfo forkedJvmInfo;
  private final Description description;
  private final long lastActivity;
  private final long currentTime;

  public HeartBeatEvent(ForkedJvmInfo forkedJvmInfo, Description description, long lastActivity, long currentTime) {
    this.forkedJvmInfo = forkedJvmInfo;
    this.description = description;
    this.lastActivity = lastActivity;
    this.currentTime = currentTime;
  }
  
  public Description getDescription() {
    return description;
  }
  
  public long getCurrentTime() {
    return currentTime;
  }
  
  public long getLastActivity() {
    return lastActivity;
  }

  public long getNoEventDuration() {
    return getCurrentTime() - getLastActivity();
  }

  public ForkedJvmInfo getForkedJvmInfo() {
    return forkedJvmInfo;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy