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

com.yy.httpproxy.requester.RequestInfo Maven / Gradle / Ivy

package com.yy.httpproxy.requester;

import java.io.Serializable;
import java.math.BigInteger;
import java.security.SecureRandom;

/**
 * Created by xuduo on 10/16/15.
 */
public class RequestInfo implements Serializable{

    private String sequenceId = new BigInteger(130, new SecureRandom()).toString(32);
    private byte[] body;
    private String path;
    private boolean expectReply = false;
    private long timestamp;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getSequenceId() {
        return sequenceId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp() {
        this.timestamp = System.currentTimeMillis();
    }

    public boolean timeoutForRequest(long timeout) {
        return System.currentTimeMillis() - timestamp > timeout;
    }

    public byte[] getBody() {
        return body;
    }

    public void setBody(byte[] body) {
        this.body = body;
    }

    public boolean isExpectReply() {
        return expectReply;
    }

    public void setExpectReply(boolean expectReply) {
        this.expectReply = expectReply;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy