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

com.hannesdorfmann.httpkit.threading.HttpExecutor Maven / Gradle / Ivy

package com.hannesdorfmann.httpkit.threading;

import com.hannesdorfmann.httpkit.request.HttpRequest;

/**
 * A {@link HttpExecutor} is responsible to manage {@link HttpRequest}s to
 * realize the following behavior:
 * 
    *
  • Executes the {@link HttpRequest}s according there * {@link HttpRequest#getPriority()} and * {@link HttpRequest#getCreationTimestamp()} ordering
  • * *
  • Ensures that the same (waiting) {@link HttpRequest} is not executed * twice, but the other waiting {@link HttpRequest} gets the result of the other * finished one. To determine "same" {@link HttpRequest} a correct {@code}link * HttpRequest#equals(Object) and HttpRequest#hashCode()} implementation is * required, as well as {@link Comparable}
  • * *
* * @author Hannes Dorfmann * */ public interface HttpExecutor { /** * Add a task to the {@link HttpExecutor}. The scheduler will then execute * this task. The time when the task gets executed depends on the concrete * {@link HttpExecutor} implementation * * @param task * @return */ public boolean submitTask(HttpTask task); /** * Cancel all {@link HttpRequest}s of this owner * * @param owner */ public void cancelAllOfOwner(Object owner); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy