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

com.taobao.tdhs.client.net.NetParameters Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
/*
 * Copyright(C) 2011-2012 Alibaba Group Holding Limited
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  Authors:
 *    wentong 
 */

package com.taobao.tdhs.client.net;

import java.net.InetSocketAddress;

/**
 * @author 文通
 * @since 11-12-26 下午4:24
 */
public class NetParameters {

    private InetSocketAddress address;

    private int connectionNumber;

    private boolean needReconnect;

    public InetSocketAddress getAddress() {
        return address;
    }

    public void setAddress(InetSocketAddress address) {
        this.address = address;
    }

    public int getConnectionNumber() {
        return connectionNumber;
    }

    public void setConnectionNumber(int connectionNumber) {
        this.connectionNumber = connectionNumber;
    }

    public boolean isNeedReconnect() {
        return needReconnect;
    }

    public void setNeedReconnect(boolean needReconnect) {
        this.needReconnect = needReconnect;
    }

    public void isVaild() {
        if (connectionNumber <= 0) {
            throw new IllegalArgumentException("connectionNumber can't be less then one!");
        }
        if (address == null) {
            throw new IllegalArgumentException("address can't be null!");
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy