Java Code Examples for com.alibaba.dubbo.common.Constants#DEFAULT_RECONNECT_PERIOD

The following examples show how to use com.alibaba.dubbo.common.Constants#DEFAULT_RECONNECT_PERIOD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractClient.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
/**
     * @param url
     * @return 0-false
     */
//
    private static int getReconnectParam(URL url) {
        int reconnect;
//        reconnect参数
        String param = url.getParameter(Constants.RECONNECT_KEY);
        if (param == null || param.length() == 0 || "true".equalsIgnoreCase(param)) {
//            默认重连周期是2000毫秒
            reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
//            默认值false
        } else if ("false".equalsIgnoreCase(param)) {
            reconnect = 0;
        } else {
            try {
                reconnect = Integer.parseInt(param);
            } catch (Exception e) {
                throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:" + param);
            }
            if (reconnect < 0) {
                throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:" + param);
            }
        }
        return reconnect;
    }
 
Example 2
Source File: AbstractClient.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * @param url
 * @return 0-false
 */
private static int getReconnectParam(URL url){
    int reconnect ;
    String param = url.getParameter(Constants.RECONNECT_KEY);
    if (param == null || param.length()==0 || "true".equalsIgnoreCase(param)){
        reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
    }else if ("false".equalsIgnoreCase(param)){
        reconnect = 0;
    } else {
        try{
            reconnect = Integer.parseInt(param);
        }catch (Exception e) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
        if(reconnect < 0){
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
    }
    return reconnect;
}
 
Example 3
Source File: AbstractClient.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
/**
 * @param url
 * @return 0-false
 */
private static int getReconnectParam(URL url){
    int reconnect ;
    String param = url.getParameter(Constants.RECONNECT_KEY);
    if (param == null || param.length()==0 || "true".equalsIgnoreCase(param)){
        reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
    }else if ("false".equalsIgnoreCase(param)){
        reconnect = 0;
    } else {
        try{
            reconnect = Integer.parseInt(param);
        }catch (Exception e) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
        if(reconnect < 0){
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
    }
    return reconnect;
}
 
Example 4
Source File: AbstractClient.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
/**
 * @param url url
 * @return 0-false
 */
private static int getReconnectParam(URL url) {
    int reconnect;
    String param = url.getParameter(Constants.RECONNECT_KEY);
    if (param == null || param.length() == 0 || "true".equalsIgnoreCase(param)) {
        reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
    } else if ("false".equalsIgnoreCase(param)) {
        reconnect = 0;
    } else {
        try {
            reconnect = Integer.parseInt(param);
        } catch (Exception e) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:" + param);
        }
        if (reconnect < 0) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:" + param);
        }
    }
    return reconnect;
}
 
Example 5
Source File: AbstractClient.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * @param url
 * @return 0-false
 */
private static int getReconnectParam(URL url){
    int reconnect ;
    String param = url.getParameter(Constants.RECONNECT_KEY);
    if (param == null || param.length()==0 || "true".equalsIgnoreCase(param)){
        reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
    }else if ("false".equalsIgnoreCase(param)){
        reconnect = 0;
    } else {
        try{
            reconnect = Integer.parseInt(param);
        }catch (Exception e) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
        if(reconnect < 0){
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
    }
    return reconnect;
}
 
Example 6
Source File: AbstractClient.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * @param url
 * @return 0-false
 */
private static int getReconnectParam(URL url){
    int reconnect ;
    String param = url.getParameter(Constants.RECONNECT_KEY);
    if (param == null || param.length()==0 || "true".equalsIgnoreCase(param)){
        reconnect = Constants.DEFAULT_RECONNECT_PERIOD;
    }else if ("false".equalsIgnoreCase(param)){
        reconnect = 0;
    } else {
        try{
            reconnect = Integer.parseInt(param);
        }catch (Exception e) {
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
        if(reconnect < 0){
            throw new IllegalArgumentException("reconnect param must be nonnegative integer or false/true. input is:"+param);
        }
    }
    return reconnect;
}