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

com.taosdata.jdbc.ws.FutureResponse Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
package com.taosdata.jdbc.ws;

import com.taosdata.jdbc.ws.entity.Response;

import java.util.concurrent.CompletableFuture;

public class FutureResponse implements Comparable {
    private final String action;
    private final Long id;
    private final CompletableFuture future;
    private final long timestamp;

    public FutureResponse(String action, Long id, CompletableFuture future) {
        this.action = action;
        this.id = id;
        this.future = future;
        timestamp = System.nanoTime();
    }

    public String getAction() {
        return action;
    }

    public Long getId() {
        return id;
    }

    public CompletableFuture getFuture() {
        return future;
    }

    long getTimestamp() {
        return timestamp;
    }

    @Override
    public int compareTo(FutureResponse fr) {
        long r = this.timestamp - fr.timestamp;
        if (r > 0) return 1;
        if (r < 0) return -1;
        return 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy