protected KeepAlive configureKeepAlive(Http http) { int timeoutInSeconds = 60; int maxConnections = 256; if (http != null) { try { timeoutInSeconds = Integer.parseInt(http.getTimeoutSeconds()); } catch (NumberFormatException ex) { // String msg = _rb.getString("pewebcontainer.invalidKeepAliveTimeout"); String msg = "pewebcontainer.invalidKeepAliveTimeout"; msg = MessageFormat.format(msg, http.getTimeoutSeconds(), Integer.toString(timeoutInSeconds)); logger.log(Level.WARNING, msg, ex); } try { maxConnections = Integer.parseInt(http.getMaxConnections()); } catch (NumberFormatException ex) { // String msg = _rb.getString("pewebcontainer.invalidKeepAliveMaxConnections"); String msg = "pewebcontainer.invalidKeepAliveMaxConnections"; msg = MessageFormat.format(msg, http.getMaxConnections(), Integer.toString(maxConnections)); logger.log(Level.WARNING, msg, ex); } } final KeepAlive keepAlive = new KeepAlive(); keepAlive.setIdleTimeoutInSeconds(timeoutInSeconds); keepAlive.setMaxRequestsCount(maxConnections); return keepAlive; }
protected KeepAlive configureKeepAlive(final Http http) { int timeoutInSeconds = 60; int maxConnections = 256; if (http != null) { try { timeoutInSeconds = Integer.parseInt(http.getTimeoutSeconds()); } catch (NumberFormatException ex) { // String msg = _rb.getString("pewebcontainer.invalidKeepAliveTimeout"); String msg = "pewebcontainer.invalidKeepAliveTimeout"; msg = MessageFormat.format(msg, http.getTimeoutSeconds(), Integer.toString(timeoutInSeconds)); LOGGER.log(Level.WARNING, msg, ex); } try { maxConnections = Integer.parseInt(http.getMaxConnections()); } catch (NumberFormatException ex) { // String msg = _rb.getString("pewebcontainer.invalidKeepAliveMaxConnections"); String msg = "pewebcontainer.invalidKeepAliveMaxConnections"; msg = MessageFormat.format(msg, http.getMaxConnections(), Integer.toString(maxConnections)); LOGGER.log(Level.WARNING, msg, ex); } } final KeepAlive keepAlive = new KeepAlive(); keepAlive.setIdleTimeoutInSeconds(timeoutInSeconds); keepAlive.setMaxRequestsCount(maxConnections); return keepAlive; }