Example usage for io.netty.handler.traffic AbstractTrafficShapingHandler DEFAULT_CHECK_INTERVAL

List of usage examples for io.netty.handler.traffic AbstractTrafficShapingHandler DEFAULT_CHECK_INTERVAL

Introduction

In this page you can find the example usage for io.netty.handler.traffic AbstractTrafficShapingHandler DEFAULT_CHECK_INTERVAL.

Prototype

long DEFAULT_CHECK_INTERVAL

To view the source code for io.netty.handler.traffic AbstractTrafficShapingHandler DEFAULT_CHECK_INTERVAL.

Click Source Link

Document

Default delay between two checks: 1s

Usage

From source file:com.nettyhttpserver.server.NettyServerInitializer.java

@Override
protected void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();/* www  .j  a  v  a2 s.  com*/
    p.addLast("codec", new HttpServerCodec());
    p.addLast("traffic",
            new NettyChannelTrafficShapingHandler(AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL));
    p.addLast("handler", new NettyServerHandler());
}

From source file:org.waarp.ftp.simpleimpl.config.FileBasedConfiguration.java

License:Open Source License

/**
 * Initiate the configuration from the xml file
 * //from   w w w. j a v a2 s.c o  m
 * @param filename
 * @return True if OK
 */
@SuppressWarnings("unchecked")
public boolean setConfigurationFromXml(String filename) {
    Document document = null;
    // Open config file
    try {
        document = new SAXReader().read(filename);
    } catch (DocumentException e) {
        logger.error("Unable to read the XML Config file: " + filename, e);
        return false;
    }
    if (document == null) {
        logger.error("Unable to read the XML Config file: " + filename);
        return false;
    }
    Node nodebase, node = null;
    node = document.selectSingleNode(XML_SERVER_PASSWD);
    if (node == null) {
        logger.error("Unable to find Password in Config file: " + filename);
        return false;
    }
    String passwd = node.getText();
    setPassword(passwd);
    node = document.selectSingleNode(XML_SERVER_PORT);
    int port = 21;
    if (node != null) {
        port = Integer.parseInt(node.getText());
    }
    setServerPort(port);
    node = document.selectSingleNode(XML_SERVER_ADDRESS);
    String address = null;
    if (node != null) {
        address = node.getText();
    }
    setServerAddress(address);
    node = document.selectSingleNode(XML_SERVER_HOME);
    if (node == null) {
        logger.error("Unable to find Home in Config file: " + filename);
        return false;
    }
    String path = node.getText();
    File file = new File(path);
    try {
        setBaseDirectory(FilesystemBasedDirImpl.normalizePath(file.getCanonicalPath()));
    } catch (IOException e1) {
        logger.error("Unable to set Home in Config file: " + filename);
        return false;
    }
    if (!file.isDirectory()) {
        logger.error("Home is not a directory in Config file: " + filename);
        return false;
    }
    node = document.selectSingleNode(XML_SERVER_THREAD);
    if (node != null) {
        SERVER_THREAD = Integer.parseInt(node.getText());
    }
    node = document.selectSingleNode(XML_CLIENT_THREAD);
    if (node != null) {
        CLIENT_THREAD = Integer.parseInt(node.getText());
    }
    if (SERVER_THREAD == 0 || CLIENT_THREAD == 0) {
        computeNbThreads();
    }
    node = document.selectSingleNode(XML_LIMITGLOBAL);
    if (node != null) {
        serverGlobalReadLimit = Long.parseLong(node.getText());
        if (serverGlobalReadLimit <= 0) {
            serverGlobalReadLimit = 0;
        }
        serverGlobalWriteLimit = serverGlobalReadLimit;
        logger.warn("Global Limit: {}", serverGlobalReadLimit);
    }
    node = document.selectSingleNode(XML_LIMITSESSION);
    if (node != null) {
        serverChannelReadLimit = Long.parseLong(node.getText());
        if (serverChannelReadLimit <= 0) {
            serverChannelReadLimit = 0;
        }
        serverChannelWriteLimit = serverChannelReadLimit;
        logger.warn("SessionInterface Limit: {}", serverChannelReadLimit);
    }
    delayLimit = AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL;
    node = document.selectSingleNode(XML_TIMEOUTCON);
    if (node != null) {
        TIMEOUTCON = Integer.parseInt(node.getText());
    }
    node = document.selectSingleNode(XML_DELETEONABORT);
    if (node != null) {
        deleteOnAbort = Integer.parseInt(node.getText()) == 1 ? true : false;
    }
    node = document.selectSingleNode(XML_USENIO);
    if (node != null) {
        FilesystemBasedFileParameterImpl.useNio = Integer.parseInt(node.getText()) == 1 ? true : false;
    }
    node = document.selectSingleNode(XML_USEFASTMD5);
    if (node != null) {
        FilesystemBasedDigest.useFastMd5 = Integer.parseInt(node.getText()) == 1 ? true : false;
    } else {
        FilesystemBasedDigest.useFastMd5 = false;
    }
    node = document.selectSingleNode(XML_BLOCKSIZE);
    if (node != null) {
        BLOCKSIZE = Integer.parseInt(node.getText());
    }
    node = document.selectSingleNode(XML_RANGE_PORT_MIN);
    int min = 100;
    if (node != null) {
        min = Integer.parseInt(node.getText());
    }
    node = document.selectSingleNode(XML_RANGE_PORT_MAX);
    int max = 65535;
    if (node != null) {
        max = Integer.parseInt(node.getText());
    }
    CircularIntValue rangePort = new CircularIntValue(min, max);
    setRangePort(rangePort);
    // We use Apache Commons IO
    FilesystemBasedDirJdkAbstract.ueApacheCommonsIo = true;
    node = document.selectSingleNode(XML_AUTHENTIFICATION_FILE);
    if (node == null) {
        logger.error("Unable to find Authentication file in Config file: " + filename);
        return false;
    }
    String fileauthent = node.getText();
    document = null;
    try {
        document = new SAXReader().read(fileauthent);
    } catch (DocumentException e) {
        logger.error("Unable to read the XML Authentication file: " + fileauthent, e);
        return false;
    }
    if (document == null) {
        logger.error("Unable to read the XML Authentication file: " + fileauthent);
        return false;
    }
    List<Node> list = document.selectNodes(XML_AUTHENTIFICATION_BASED);
    Iterator<Node> iterator = list.iterator();
    while (iterator.hasNext()) {
        nodebase = iterator.next();
        node = nodebase.selectSingleNode(XML_AUTHENTIFICATION_USER);
        if (node == null) {
            continue;
        }
        String user = node.getText();
        node = nodebase.selectSingleNode(XML_AUTHENTIFICATION_PASSWD);
        if (node == null) {
            continue;
        }
        String userpasswd = node.getText();
        node = nodebase.selectSingleNode(XML_AUTHENTIFICATION_ADMIN);
        boolean isAdmin = false;
        if (node != null) {
            isAdmin = node.getText().equals("1") ? true : false;
        }
        List<Node> listaccount = nodebase.selectNodes(XML_AUTHENTIFICATION_ACCOUNT);
        String[] account = null;
        if (!listaccount.isEmpty()) {
            account = new String[listaccount.size()];
            int i = 0;
            Iterator<Node> iteratoraccount = listaccount.iterator();
            while (iteratoraccount.hasNext()) {
                node = iteratoraccount.next();
                account[i] = node.getText();
                // logger.debug("User: {} Acct: {}", user, account[i]);
                i++;
            }
        }
        SimpleAuth auth = new SimpleAuth(user, userpasswd, account);
        auth.setAdmin(isAdmin);
        authentications.put(user, auth);
    }
    document = null;
    return true;
}

From source file:org.waarp.gateway.ftp.config.FileBasedConfiguration.java

License:Open Source License

private boolean loadLimit(boolean updateLimit) {
    XmlValue value = hashConfig.get(XML_LIMITGLOBAL);
    if (value != null && (!value.isEmpty())) {
        serverGlobalReadLimit = value.getLong();
        if (serverGlobalReadLimit <= 0) {
            serverGlobalReadLimit = 0;//from www  .j  ava2s  .c o m
        }
        serverGlobalWriteLimit = serverGlobalReadLimit;
        logger.info("Global Limit: {}", serverGlobalReadLimit);
    }
    value = hashConfig.get(XML_LIMITSESSION);
    if (value != null && (!value.isEmpty())) {
        serverChannelReadLimit = value.getLong();
        if (serverChannelReadLimit <= 0) {
            serverChannelReadLimit = 0;
        }
        serverChannelWriteLimit = serverChannelReadLimit;
        logger.info("SessionInterface Limit: {}", serverChannelReadLimit);
    }
    delayLimit = AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL;
    value = hashConfig.get(XML_LIMITDELAY);
    if (value != null && (!value.isEmpty())) {
        delayLimit = (value.getLong() / 10) * 10;
        if (delayLimit <= 0) {
            delayLimit = 0;
        }
        logger.info("Delay Limit: {}", delayLimit);
    }
    boolean useCpuLimit = false;
    boolean useCpuLimitJDK = false;
    double cpulimit = 1.0;
    value = hashConfig.get(XML_CSTRT_USECPULIMIT);
    if (value != null && (!value.isEmpty())) {
        useCpuLimit = value.getBoolean();
        value = hashConfig.get(XML_CSTRT_USECPUJDKLIMIT);
        if (value != null && (!value.isEmpty())) {
            useCpuLimitJDK = value.getBoolean();
        }
        value = hashConfig.get(XML_CSTRT_CPULIMIT);
        if (value != null && (!value.isEmpty())) {
            cpulimit = value.getDouble();
        }
    }
    int connlimit = 0;
    value = hashConfig.get(XML_CSTRT_CONNLIMIT);
    if (value != null && (!value.isEmpty())) {
        connlimit = value.getInteger();
    }
    double lowcpuLimit = 0;
    double highcpuLimit = 0;
    double percentageDecrease = 0;
    long delay = 1000000;
    long limitLowBandwidth = 4096;
    value = hashConfig.get(XML_CSTRT_LOWCPULIMIT);
    if (value != null && (!value.isEmpty())) {
        lowcpuLimit = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_HIGHCPULIMIT);
    if (value != null && (!value.isEmpty())) {
        highcpuLimit = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_PERCENTDECREASE);
    if (value != null && (!value.isEmpty())) {
        percentageDecrease = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_DELAYTHROTTLE);
    if (value != null && (!value.isEmpty())) {
        delay = (value.getLong() / 10) * 10;
    }
    value = hashConfig.get(XML_CSTRT_LIMITLOWBANDWIDTH);
    if (value != null && (!value.isEmpty())) {
        limitLowBandwidth = value.getLong();
    }
    value = hashConfig.get(XML_TIMEOUTCON);
    if (value != null && (!value.isEmpty())) {
        TIMEOUTCON = (value.getLong() / 10) * 10;
    }
    if (highcpuLimit > 0) {
        constraintLimitHandler = new FtpConstraintLimitHandler(TIMEOUTCON, useCpuLimit, useCpuLimitJDK,
                cpulimit, connlimit, lowcpuLimit, highcpuLimit, percentageDecrease, null, delay,
                limitLowBandwidth);
    } else {
        constraintLimitHandler = new FtpConstraintLimitHandler(TIMEOUTCON, useCpuLimit, useCpuLimitJDK,
                cpulimit, connlimit);
    }
    value = hashConfig.get(XML_SERVER_THREAD);
    if (value != null && (!value.isEmpty())) {
        SERVER_THREAD = value.getInteger();
    }
    value = hashConfig.get(XML_CLIENT_THREAD);
    if (value != null && (!value.isEmpty())) {
        CLIENT_THREAD = value.getInteger();
    }
    if (SERVER_THREAD == 0 || CLIENT_THREAD == 0) {
        computeNbThreads();
    }
    value = hashConfig.get(XML_MEMORY_LIMIT);
    if (value != null && (!value.isEmpty())) {
        maxGlobalMemory = value.getLong();
    }
    ((FilesystemBasedFileParameterImpl) getFileParameter()).deleteOnAbort = false;
    value = hashConfig.get(XML_USENIO);
    if (value != null && (!value.isEmpty())) {
        FilesystemBasedFileParameterImpl.useNio = value.getBoolean();
    }
    value = hashConfig.get(XML_USEFASTMD5);
    if (value != null && (!value.isEmpty())) {
        FilesystemBasedDigest.useFastMd5 = value.getBoolean();
    }
    value = hashConfig.get(XML_BLOCKSIZE);
    if (value != null && (!value.isEmpty())) {
        BLOCKSIZE = value.getInteger();
    }
    value = hashConfig.get(XML_DELETEONABORT);
    if (value != null && (!value.isEmpty())) {
        deleteOnAbort = value.getBoolean();
    }
    // We use Apache Commons IO
    FilesystemBasedDirJdkAbstract.ueApacheCommonsIo = true;
    return true;
}

From source file:org.waarp.openr66.configuration.FileBasedConfiguration.java

License:Open Source License

/**
 * // w  w  w.j av  a2 s . c  om
 * @param config
 * @param updateLimit
 * @return True if the limit configuration is correctly loaded
 */
private static boolean loadLimit(Configuration config, boolean updateLimit) {
    if (alreadySetLimit) {
        return true;
    }
    XmlHash hashConfig = new XmlHash(hashRootConfig.get(XML_LIMIT));
    try {
        XmlValue value = hashConfig.get(XML_LIMITGLOBAL);
        if (value != null && (!value.isEmpty())) {
            config.setServerGlobalReadLimit(value.getLong());
            if (config.getServerGlobalReadLimit() <= 0) {
                config.setServerGlobalReadLimit(0);
            }
            config.setServerGlobalWriteLimit(config.getServerGlobalReadLimit());
            logger.info("Global Limit: {}", config.getServerGlobalReadLimit());
        }
        value = hashConfig.get(XML_LIMITSESSION);
        if (value != null && (!value.isEmpty())) {
            config.setServerChannelReadLimit(value.getLong());
            if (config.getServerChannelReadLimit() <= 0) {
                config.setServerChannelReadLimit(0);
            }
            config.setServerChannelWriteLimit(config.getServerChannelReadLimit());
            logger.info("SessionInterface Limit: {}", config.getServerChannelReadLimit());
        }
        config.setAnyBandwidthLimitation(
                (config.getServerGlobalReadLimit() > 0 || config.getServerGlobalWriteLimit() > 0
                        || config.getServerChannelReadLimit() > 0 || config.getServerChannelWriteLimit() > 0));
        config.setDelayLimit(AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL);
        value = hashConfig.get(XML_LIMITDELAY);
        if (value != null && (!value.isEmpty())) {
            config.setDelayLimit((value.getLong() / 10) * 10);
            if (config.getDelayLimit() <= 0) {
                config.setDelayLimit(0);
            }
            logger.info("Delay Limit: {}", config.getDelayLimit());
        }
        value = hashConfig.get(XML_LIMITRUNNING);
        if (value != null && (!value.isEmpty())) {
            config.setRUNNER_THREAD(value.getInteger());
        }
        if (config.getRUNNER_THREAD() < 10) {
            config.setRUNNER_THREAD(10);
        }
        logger.info("Limit of Runner: {}", config.getRUNNER_THREAD());
        value = hashConfig.get(XML_DELAYCOMMANDER);
        if (value != null && (!value.isEmpty())) {
            config.setDelayCommander((value.getLong() / 10) * 10);
            if (config.getDelayCommander() <= 100) {
                config.setDelayCommander(100);
            }
            logger.info("Delay Commander: {}", config.getDelayCommander());
        }
        value = hashConfig.get(XML_DELAYRETRY);
        if (value != null && (!value.isEmpty())) {
            config.setDelayRetry((value.getLong() / 10) * 10);
            if (config.getDelayRetry() <= 1000) {
                config.setDelayRetry(1000);
            }
            logger.info("Delay Retry: {}", config.getDelayRetry());
        }
        if (DbConstant.admin.isActive() && updateLimit) {
            value = hashConfig.get(XML_SERVER_HOSTID);
            if (value != null && (!value.isEmpty())) {
                config.setHOST_ID(value.getString());
                DbConfiguration configuration = new DbConfiguration(DbConstant.admin.getSession(),
                        config.getHOST_ID(), config.getServerGlobalReadLimit(),
                        config.getServerGlobalWriteLimit(), config.getServerChannelReadLimit(),
                        config.getServerChannelWriteLimit(), config.getDelayLimit());
                configuration.changeUpdatedInfo(UpdatedInfo.TOSUBMIT);
                try {
                    if (configuration.exist()) {
                        configuration.update();
                    } else {
                        configuration.insert();
                    }
                } catch (WaarpDatabaseException e) {
                }
            }
        }
        boolean useCpuLimit = false;
        boolean useCpuLimitJDK = false;
        double cpulimit = 1.0;
        value = hashConfig.get(XML_CSTRT_USECPULIMIT);
        if (value != null && (!value.isEmpty())) {
            useCpuLimit = value.getBoolean();
            value = hashConfig.get(XML_CSTRT_USECPUJDKLIMIT);
            if (value != null && (!value.isEmpty())) {
                useCpuLimitJDK = value.getBoolean();
            }
            value = hashConfig.get(XML_CSTRT_CPULIMIT);
            if (value != null && (!value.isEmpty())) {
                cpulimit = value.getDouble();
                if (cpulimit > 0.99) {
                    cpulimit = 1.0;
                }
            }
        }
        int connlimit = 0;
        value = hashConfig.get(XML_CSTRT_CONNLIMIT);
        if (value != null && (!value.isEmpty())) {
            connlimit = value.getInteger();
            if (connlimit < 100) {
                connlimit = 0;
            }
        }
        double lowcpuLimit = 0.0;
        double highcpuLimit = 0.0;
        double percentageDecrease = 0;
        long delay = 1000000;
        long limitLowBandwidth = R66ConstraintLimitHandler.LOWBANDWIDTH_DEFAULT;
        value = hashConfig.get(XML_CSTRT_LOWCPULIMIT);
        if (value != null && (!value.isEmpty())) {
            lowcpuLimit = value.getDouble();
        }
        value = hashConfig.get(XML_CSTRT_HIGHCPULIMIT);
        if (value != null && (!value.isEmpty())) {
            highcpuLimit = value.getDouble();
            if (highcpuLimit < 0.1) {
                highcpuLimit = 0.0;
            }
        }
        value = hashConfig.get(XML_CSTRT_PERCENTDECREASE);
        if (value != null && (!value.isEmpty())) {
            percentageDecrease = value.getDouble();
        }
        value = hashConfig.get(XML_CSTRT_DELAYTHROTTLE);
        if (value != null && (!value.isEmpty())) {
            delay = (value.getLong() / 10) * 10;
            if (delay < 100) {
                delay = 100;
            }
        }
        value = hashConfig.get(XML_CSTRT_LIMITLOWBANDWIDTH);
        if (value != null && (!value.isEmpty())) {
            limitLowBandwidth = value.getLong();
        }
        if (useCpuLimit || highcpuLimit > 0) {
            if (highcpuLimit > 0) {
                logger.debug("full setup of ContraintLimitHandler");
                config.setConstraintLimitHandler(
                        new R66ConstraintLimitHandler(useCpuLimit, useCpuLimitJDK, cpulimit, connlimit,
                                lowcpuLimit, highcpuLimit, percentageDecrease, null, delay, limitLowBandwidth));
            } else {
                logger.debug("partial setup of ContraintLimitHandler");
                config.setConstraintLimitHandler(
                        new R66ConstraintLimitHandler(useCpuLimit, useCpuLimitJDK, cpulimit, connlimit));
            }
        } else {
            logger.debug("No setup of ContraintLimitHandler");
            config.setConstraintLimitHandler(new R66ConstraintLimitHandler(false, false, 1.0, connlimit));
        }
        value = hashConfig.get(XML_SERVER_THREAD);
        if (value != null && (!value.isEmpty())) {
            config.setSERVER_THREAD(value.getInteger());
        }
        value = hashConfig.get(XML_CLIENT_THREAD);
        if (value != null && (!value.isEmpty())) {
            config.setCLIENT_THREAD(value.getInteger());
        }
        value = hashConfig.get(XML_MEMORY_LIMIT);
        if (value != null && (!value.isEmpty())) {
            config.setMaxGlobalMemory(value.getLong());
        }
        Configuration.getFileParameter().deleteOnAbort = false;
        value = hashConfig.get(XML_USENIO);
        if (value != null && (!value.isEmpty())) {
            FilesystemBasedFileParameterImpl.useNio = value.getBoolean();
        }
        value = hashConfig.get(XML_DIGEST);
        if (value != null && (!value.isEmpty())) {
            try {
                int val = value.getInteger();
                if (val < 0 || val >= DigestAlgo.values().length) {
                    val = 0;
                }
                config.setDigest(DigestAlgo.values()[val]);
            } catch (IllegalArgumentException e) {
                // might be String
                String val = value.getString();
                config.setDigest(PartnerConfiguration.getDigestAlgo(val));
            }
        }
        logger.info("DigestAlgo used: {}", config.getDigest());
        value = hashConfig.get(XML_USEFASTMD5);
        if (value != null && (!value.isEmpty())) {
            FilesystemBasedDigest.setUseFastMd5(value.getBoolean());
        } else {
            FilesystemBasedDigest.setUseFastMd5(false);
        }
        value = hashConfig.get(XML_GAPRESTART);
        if (value != null && (!value.isEmpty())) {
            Configuration.setRANKRESTART(value.getInteger());
            if (Configuration.getRANKRESTART() <= 0) {
                Configuration.setRANKRESTART(1);
            }
        }
        value = hashConfig.get(XML_BLOCKSIZE);
        if (value != null && (!value.isEmpty())) {
            config.setBLOCKSIZE(value.getInteger());
        }
        value = hashConfig.get(XML_USETHRIFT);
        if (value != null && (!value.isEmpty())) {
            config.setThriftport(value.getInteger());
        }
        value = hashConfig.get(XML_TIMEOUTCON);
        if (value != null && (!value.isEmpty())) {
            config.setTIMEOUTCON((value.getLong() / 10) * 10);
            config.getShutdownConfiguration().timeout = config.getTIMEOUTCON();
        }
        value = hashConfig.get(XML_CHECKVERSION);
        if (value != null && (!value.isEmpty())) {
            config.setExtendedProtocol(value.getBoolean());
            logger.info("ExtendedProtocol= " + config.isExtendedProtocol());
        }
        value = hashConfig.get(XML_GLOBALDIGEST);
        if (value != null && (!value.isEmpty())) {
            config.setGlobalDigest(value.getBoolean());
        }
        alreadySetLimit = true;
        return true;
    } finally {
        hashConfig.clear();
        hashConfig = null;
    }
}

From source file:org.waarp.openr66.proxy.configuration.FileBasedConfiguration.java

License:Open Source License

private static boolean loadLimit(Configuration config, boolean updateLimit) {
    if (alreadySetLimit) {
        return true;
    }/*w w  w.  jav a 2 s .  c om*/
    XmlValue value = hashConfig.get(XML_LIMITGLOBAL);
    if (value != null && (!value.isEmpty())) {
        config.setServerGlobalReadLimit(value.getLong());
        if (config.getServerGlobalReadLimit() <= 0) {
            config.setServerGlobalReadLimit(0);
        }
        config.setServerGlobalWriteLimit(config.getServerGlobalReadLimit());
        logger.info("Global Limit: {}", config.getServerGlobalReadLimit());
    }
    value = hashConfig.get(XML_LIMITSESSION);
    if (value != null && (!value.isEmpty())) {
        config.setServerChannelReadLimit(value.getLong());
        if (config.getServerChannelReadLimit() <= 0) {
            config.setServerChannelReadLimit(0);
        }
        config.setServerChannelWriteLimit(config.getServerChannelReadLimit());
        logger.info("SessionInterface Limit: {}", config.getServerChannelReadLimit());
    }
    config.setAnyBandwidthLimitation(
            (config.getServerGlobalReadLimit() > 0 || config.getServerGlobalWriteLimit() > 0
                    || config.getServerChannelReadLimit() > 0 || config.getServerChannelWriteLimit() > 0));
    config.setDelayLimit(AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL);
    value = hashConfig.get(XML_LIMITDELAY);
    if (value != null && (!value.isEmpty())) {
        config.setDelayLimit((value.getLong() / 10) * 10);
        if (config.getDelayLimit() <= 0) {
            config.setDelayLimit(0);
        }
        logger.info("Delay Limit: {}", config.getDelayLimit());
    }
    value = hashConfig.get(XML_DELAYRETRY);
    if (value != null && (!value.isEmpty())) {
        config.setDelayRetry((value.getLong() / 10) * 10);
        if (config.getDelayRetry() <= 1000) {
            config.setDelayRetry(1000);
        }
        logger.info("Delay Retry: {}", config.getDelayRetry());
    }
    if (config.getRUNNER_THREAD() < 10) {
        config.setRUNNER_THREAD(10);
    }
    logger.info("Limit of Runner: {}", config.getRUNNER_THREAD());
    if (DbConstant.admin.isActive() && updateLimit) {
        value = hashConfig.get(XML_SERVER_HOSTID);
        if (value != null && (!value.isEmpty())) {
            config.setHOST_ID(value.getString());
            DbConfiguration configuration = new DbConfiguration(DbConstant.admin.getSession(),
                    config.getHOST_ID(), config.getServerGlobalReadLimit(), config.getServerGlobalWriteLimit(),
                    config.getServerChannelReadLimit(), config.getServerChannelWriteLimit(),
                    config.getDelayLimit());
            configuration.changeUpdatedInfo(UpdatedInfo.TOSUBMIT);
            try {
                if (configuration.exist()) {
                    configuration.update();
                } else {
                    configuration.insert();
                }
            } catch (WaarpDatabaseException e) {
            }
        }
    }
    boolean useCpuLimit = false;
    boolean useCpuLimitJDK = false;
    double cpulimit = 1.0;
    value = hashConfig.get(XML_CSTRT_USECPULIMIT);
    if (value != null && (!value.isEmpty())) {
        useCpuLimit = value.getBoolean();
        value = hashConfig.get(XML_CSTRT_USECPUJDKLIMIT);
        if (value != null && (!value.isEmpty())) {
            useCpuLimitJDK = value.getBoolean();
        }
        value = hashConfig.get(XML_CSTRT_CPULIMIT);
        if (value != null && (!value.isEmpty())) {
            cpulimit = value.getDouble();
        }
    }
    int connlimit = 0;
    value = hashConfig.get(XML_CSTRT_CONNLIMIT);
    if (value != null && (!value.isEmpty())) {
        connlimit = value.getInteger();
    }
    double lowcpuLimit = 0;
    double highcpuLimit = 0;
    double percentageDecrease = 0;
    long delay = 1000000;
    long limitLowBandwidth = 4096;
    value = hashConfig.get(XML_CSTRT_LOWCPULIMIT);
    if (value != null && (!value.isEmpty())) {
        lowcpuLimit = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_HIGHCPULIMIT);
    if (value != null && (!value.isEmpty())) {
        highcpuLimit = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_PERCENTDECREASE);
    if (value != null && (!value.isEmpty())) {
        percentageDecrease = value.getDouble();
    }
    value = hashConfig.get(XML_CSTRT_DELAYTHROTTLE);
    if (value != null && (!value.isEmpty())) {
        delay = (value.getLong() / 10) * 10;
    }
    value = hashConfig.get(XML_CSTRT_LIMITLOWBANDWIDTH);
    if (value != null && (!value.isEmpty())) {
        limitLowBandwidth = value.getLong();
    }
    if (highcpuLimit > 0) {
        config.setConstraintLimitHandler(new R66ConstraintLimitHandler(useCpuLimit, useCpuLimitJDK, cpulimit,
                connlimit, lowcpuLimit, highcpuLimit, percentageDecrease, null, delay, limitLowBandwidth));
    } else {
        config.setConstraintLimitHandler(
                new R66ConstraintLimitHandler(useCpuLimit, useCpuLimitJDK, cpulimit, connlimit));
    }
    value = hashConfig.get(XML_SERVER_THREAD);
    if (value != null && (!value.isEmpty())) {
        config.setSERVER_THREAD(value.getInteger());
    }
    value = hashConfig.get(XML_CLIENT_THREAD);
    if (value != null && (!value.isEmpty())) {
        config.setCLIENT_THREAD(value.getInteger());
    }
    value = hashConfig.get(XML_MEMORY_LIMIT);
    if (value != null && (!value.isEmpty())) {
        config.setMaxGlobalMemory(value.getLong());
    }
    Configuration.getFileParameter().deleteOnAbort = false;
    value = hashConfig.get(XML_TIMEOUTCON);
    if (value != null && (!value.isEmpty())) {
        config.setTIMEOUTCON((value.getLong() / 10) * 10);
        config.getShutdownConfiguration().timeout = config.getTIMEOUTCON();
    }
    alreadySetLimit = true;
    return true;
}