<commit_before>package com.lamfire.hydra.reply;

import com.lamfire.hydra.Message;
import com.lamfire.hydra.exception.HydraException;
import com.lamfire.logger.Logger;

/**
 * Created with IntelliJ IDEA.
 * User: lamfire
 * Date: 14-2-17
 * Time: 下午6:04
 * To change this template use File | Settings | File Templates.
 */
public class ReplyFuture {

    private static final Logger LOGGER = Logger.getLogger(ReplyFuture.class);
    private int messageId;
    private long readTimeoutMillis = 15000;
    private Message message;


    public ReplyFuture(int messageId) {
        this.messageId = messageId;
    }

    public long getReadTimeoutMillis() {
        return readTimeoutMillis;
    }

    public void setReadTimeoutMillis(long readTimeoutMillis) {
        this.readTimeoutMillis = readTimeoutMillis;
    }

    public int getMessageId() {
        return messageId;
    }

    public void setMessageId(int messageId) {
        this.messageId = messageId;
    }

    public synchronized void await(){
        await(readTimeoutMillis);
    }

    public synchronized void await(long millis){
        try {
            if (message == null) {
                this.wait(millis);
            }
        } catch (InterruptedException e) {
            LOGGER.error(e.getMessage(),e);
            throw new HydraException(e.getMessage(), e);
        }
    }

    synchronized void onReceivedReply(Message message) {
        this.message = message;
        this.notifyAll();
    }

    public byte[] getReply(){
        if(this.message == null){
            await();
        }

        if(this.message == null){
            throw new HydraException("Read response timeout.");
        }
        return this.message.getBody();
    }
}
<commit_msg>修改Reply超时时间默认为120秒<commit_after>package com.lamfire.hydra.reply;

import com.lamfire.hydra.Message;
import com.lamfire.hydra.exception.HydraException;
import com.lamfire.logger.Logger;

/**
 * Created with IntelliJ IDEA.
 * User: lamfire
 * Date: 14-2-17
 * Time: 下午6:04
 * To change this template use File | Settings | File Templates.
 */
public class ReplyFuture {

    private static final Logger LOGGER = Logger.getLogger(ReplyFuture.class);
    private int messageId;
    private long readTimeoutMillis = 120000;
    private Message message;


    public ReplyFuture(int messageId) {
        this.messageId = messageId;
    }

    public long getReadTimeoutMillis() {
        return readTimeoutMillis;
    }

    public void setReadTimeoutMillis(long readTimeoutMillis) {
        this.readTimeoutMillis = readTimeoutMillis;
    }

    public int getMessageId() {
        return messageId;
    }

    public void setMessageId(int messageId) {
        this.messageId = messageId;
    }

    public synchronized void await(){
        await(readTimeoutMillis);
    }

    public synchronized void await(long millis){
        try {
            if (message == null) {
                this.wait(millis);
            }
        } catch (InterruptedException e) {
            LOGGER.error(e.getMessage(),e);
            throw new HydraException(e.getMessage(), e);
        }
    }

    synchronized void onReceivedReply(Message message) {
        this.message = message;
        this.notifyAll();
    }

    public byte[] getReply(){
        if(this.message == null){
            await();
        }

        if(this.message == null){
            throw new HydraException("Read response timeout.");
        }
        return this.message.getBody();
    }
}

{'fraction_non_alphanumeric': 0.09345794392523364, 'fraction_numerical': 0.008246289169873557, 'mean_word_length': 2.070886075949367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4814033', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1015, 'n_words': 236}