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

com.wavefront.agent.data.DataSubmissionTask Maven / Gradle / Ivy

package com.wavefront.agent.data;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.wavefront.data.ReportableEntityType;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Nullable;

/**
 * A serializable data submission task.
 *
 * @param  task type
 * @author [email protected]
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "__CLASS")
public interface DataSubmissionTask> extends Serializable {

  /**
   * Returns a task weight.
   *
   * @return task weight
   */
  int weight();

  /**
   * Returns task enqueue time in milliseconds.
   *
   * @return enqueue time in milliseconds
   */
  long getEnqueuedMillis();

  /**
   * Execute this task
   *
   * @return operation result
   */
  TaskResult execute();

  /**
   * Persist task in the queue
   *
   * @param reason reason for queueing. used to increment metrics, if specified.
   */
  void enqueue(@Nullable QueueingReason reason);

  /**
   * Returns entity type handled.
   *
   * @return entity type
   */
  ReportableEntityType getEntityType();

  /**
   * Split the task into smaller tasks.
   *
   * @param minSplitSize Don't split the task if its weight is smaller than this number.
   * @param maxSplitSize Split tasks size cap.
   * @return tasks
   */
  List splitTask(int minSplitSize, int maxSplitSize);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy