예제 #1
0
파일: ResinHandler.cs 프로젝트: dlitz/resin
        private void init()
        {
            try {
            NameValueCollection appSettings = WebConfigurationManager.GetSection("appSettings") as NameValueCollection;

            _log = Logger.GetLogger();

            String servers = appSettings["resin.servers"];

            if ("".Equals(servers)) {
              servers = "127.0.0.1:6800";
              _log.Info("application setting 'resin.servers' is not specified. Using '{0}'", servers);
              Trace.TraceInformation("application setting 'resin.servers' is not specified. Using '{0}'", servers);
            } else {
              _log.Info("Setting servers to '{0}'", servers);
              Trace.TraceInformation("Setting servers to '{0}'", servers);
            }

            if (!String.IsNullOrEmpty(appSettings["resin.session-cookie"]))
              _sessionCookieName = appSettings["resin.session-cookie"];

            if (!String.IsNullOrEmpty(appSettings["resin.ssl-session-cookie"]))
              _sslSessionCookieName = appSettings["resin.ssl-session-cookie"];

            if ("false".Equals(appSettings["resin.sticky-sessions"], StringComparison.OrdinalIgnoreCase))
              _isStickySessions = false;

            _log.Info("Setting sticky sessions to {0}", _isStickySessions);

            if (!String.IsNullOrEmpty(appSettings["resin.session-url-prefix"]))
              _sessionUrlPrefix = appSettings["resin.session-url-prefix"];

            if (!String.IsNullOrEmpty(appSettings["resin.alternate-session-url-prefix"]))
              _sessionUrlPrefix = appSettings["resin.alternate-session-url-prefix"];

            int loadBalanceConnectTimeout = 5 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.load-balance-connect-timeout"]))
              loadBalanceConnectTimeout = ParseTime("resin.load-balance-connect-timeout", appSettings["resin.load-balance-connect-timeout"]);

            int loadBalanceIdleTime = 5 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.load-balance-idle-time"]))
              loadBalanceIdleTime = ParseTime("resin.load-balance-idle-time", appSettings["resin.load-balance-idle-time"]);

            int loadBalanceRecoverTime = 15 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.load-balance-recover-time"]))
              loadBalanceRecoverTime = ParseTime("resin.load-balance-recover-time", appSettings["resin.load-balance-recover-time"]);

            int loadBalanceSocketTimeout = 665 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.load-balance-socket-timeout"]))
              loadBalanceSocketTimeout = ParseTime("resin.load-balance-socket-timeout", appSettings["resin.load-balance-socket-timeout"]);

            int keepaliveTimeout = 15 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.keepalive-timeout"]))
              keepaliveTimeout = ParseTime("resin.keepalive-timeout", appSettings["resin.keepalive-timeout"]);

            int socketTimeout = 65 * 1000;
            if (!String.IsNullOrEmpty(appSettings["resin.socket-timeout"]))
              socketTimeout = ParseTime("resin.socket-timeout", appSettings["resin.socket-timeout"]);

            _isDebug = "true".Equals(appSettings["resin.debug"], StringComparison.OrdinalIgnoreCase);

            if (_isDebug)
              Trace.TraceInformation("Setting debug to true");

            _isCauchoStatusEnabled = !"false".Equals(appSettings["resin.caucho-status"], StringComparison.OrdinalIgnoreCase);

            _loadBalancer = new LoadBalancer(servers,
              loadBalanceConnectTimeout,
              loadBalanceIdleTime,
              loadBalanceRecoverTime,
              loadBalanceSocketTimeout,
              keepaliveTimeout,
              socketTimeout,
              _isDebug);

              } catch (ConfigurationException e) {
            _e = e;
              } catch (FormatException e) {
            _e = new ConfigurationException(e.Message, e);
              }
        }
예제 #2
0
        private void init()
        {
            NameValueCollection appSettings = WebConfigurationManager.GetSection("appSettings") as NameValueCollection;

              _log = Logger.GetLogger();

              String servers = appSettings["resin.servers"];

              if ("".Equals(servers)) {
            servers = "127.0.0.1:6080";
            _log.Info("application setting 'resin.servers' is not specified. Using '{0}'", servers);
            Trace.TraceInformation("application setting 'resin.servers' is not specified. Using '{0}'", servers);
              } else {
            _log.Info("Setting servers to '{0}'", servers);
            Trace.TraceInformation("Setting servers to '{0}'", servers);
              }

              _loadBalancer = new LoadBalancer(servers);
        }
예제 #3
0
        private void init()
        {
            try {
                NameValueCollection appSettings = WebConfigurationManager.GetSection("appSettings") as NameValueCollection;

                _log = Logger.GetLogger();

                String servers = appSettings["resin.servers"];

                if ("".Equals(servers))
                {
                    servers = "127.0.0.1:6800";
                    _log.Info("application setting 'resin.servers' is not specified. Using '{0}'", servers);
                    Trace.TraceInformation("application setting 'resin.servers' is not specified. Using '{0}'", servers);
                }
                else
                {
                    _log.Info("Setting servers to '{0}'", servers);
                    Trace.TraceInformation("Setting servers to '{0}'", servers);
                }

                if (!String.IsNullOrEmpty(appSettings["resin.session-cookie"]))
                {
                    _sessionCookieName = appSettings["resin.session-cookie"];
                }

                if (!String.IsNullOrEmpty(appSettings["resin.ssl-session-cookie"]))
                {
                    _sslSessionCookieName = appSettings["resin.ssl-session-cookie"];
                }

                if ("false".Equals(appSettings["resin.sticky-sessions"], StringComparison.OrdinalIgnoreCase))
                {
                    _isStickySessions = false;
                }

                _log.Info("Setting sticky sessions to {0}", _isStickySessions);

                if (!String.IsNullOrEmpty(appSettings["resin.session-url-prefix"]))
                {
                    _sessionUrlPrefix = appSettings["resin.session-url-prefix"];
                }

                if (!String.IsNullOrEmpty(appSettings["resin.alternate-session-url-prefix"]))
                {
                    _sessionUrlPrefix = appSettings["resin.alternate-session-url-prefix"];
                }

                int loadBalanceConnectTimeout = 5 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.load-balance-connect-timeout"]))
                {
                    loadBalanceConnectTimeout = ParseTime("resin.load-balance-connect-timeout", appSettings["resin.load-balance-connect-timeout"]);
                }

                int loadBalanceIdleTime = 5 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.load-balance-idle-time"]))
                {
                    loadBalanceIdleTime = ParseTime("resin.load-balance-idle-time", appSettings["resin.load-balance-idle-time"]);
                }

                int loadBalanceRecoverTime = 15 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.load-balance-recover-time"]))
                {
                    loadBalanceRecoverTime = ParseTime("resin.load-balance-recover-time", appSettings["resin.load-balance-recover-time"]);
                }

                int loadBalanceSocketTimeout = 665 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.load-balance-socket-timeout"]))
                {
                    loadBalanceSocketTimeout = ParseTime("resin.load-balance-socket-timeout", appSettings["resin.load-balance-socket-timeout"]);
                }

                int keepaliveTimeout = 15 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.keepalive-timeout"]))
                {
                    keepaliveTimeout = ParseTime("resin.keepalive-timeout", appSettings["resin.keepalive-timeout"]);
                }

                int socketTimeout = 65 * 1000;
                if (!String.IsNullOrEmpty(appSettings["resin.socket-timeout"]))
                {
                    socketTimeout = ParseTime("resin.socket-timeout", appSettings["resin.socket-timeout"]);
                }

                _isDebug = "true".Equals(appSettings["resin.debug"], StringComparison.OrdinalIgnoreCase);

                if (_isDebug)
                {
                    Trace.TraceInformation("Setting debug to true");
                }

                _isCauchoStatusEnabled = !"false".Equals(appSettings["resin.caucho-status"], StringComparison.OrdinalIgnoreCase);

                _loadBalancer = new LoadBalancer(servers,
                                                 loadBalanceConnectTimeout,
                                                 loadBalanceIdleTime,
                                                 loadBalanceRecoverTime,
                                                 loadBalanceSocketTimeout,
                                                 keepaliveTimeout,
                                                 socketTimeout,
                                                 _isDebug);
            } catch (ConfigurationException e) {
                _e = e;
            } catch (FormatException e) {
                _e = new ConfigurationException(e.Message, e);
            }
        }