class CarreraConfig implements Cloneable, Serializable {

    public void validate(boolean singleServer) {
        if (groupId == null || !GROUP_PATTERN.matcher(groupId).matches()) {
            throw new CarreraConfigError("Invalid groupId : " + groupId);
        }
        if (servers == null || !SERVERS_PATTERN.matcher(servers).matches()) {
            throw new CarreraConfigError("Invalid servers : " + servers);
        }
        if (singleServer && servers.contains(";")) {
            throw new CarreraConfigError("Invalid single server : " + servers);
        }

        if (timeout < 0) throw new CarreraConfigError("Invalid timeout : " + timeout);
        if (retryInterval <= 0) throw new CarreraConfigError("Invalid retryInterval : " + retryInterval);
        if (submitMaxRetries <= 0) throw new CarreraConfigError("Invalid submitMaxRetries : " + submitMaxRetries);
        if (maxBatchSize <= 0) throw new CarreraConfigError("Invalid maxBatchSize : " + maxBatchSize);
        if (maxLingerTime < 0) throw new CarreraConfigError("Invalid maxLingerTime : " + maxLingerTime);
        if (timeout < maxLingerTime || maxLingerTime * 2 > timeout)
            throw new CarreraConfigError("timeout must be more than 2 times maxLingerTime, timeout=" + timeout + ",maxLingerTime=" + maxLingerTime);
    }

    public  CarreraConfig();
    public  CarreraConfig(String groupId, String servers);

}