ConnectionThrottler(Runtime runtime, RateStatistic rateStatistic, Scheduler scheduler, AbstractConnector connector, ConnectorConfig.Throttling config) { this.connector = connector; if (config.maxHeapUtilization() != -1) { this.resourceLimits.add(new HeapResourceLimit(runtime, config.maxHeapUtilization())); } if (config.maxConnections() != -1) { this.resourceLimits.add(new ConnectionLimitThreshold(config.maxConnections())); } if (config.maxAcceptRate() != -1) { this.resourceLimits.add(new AcceptRateLimit(rateStatistic, config.maxAcceptRate())); } this.idleTimeout = config.idleTimeout() != -1 ? Duration.ofMillis((long) (config.idleTimeout()*1000)) : null; this.scheduler = scheduler; }
tcpNoDelay = (builder.tcpNoDelay == null) ? new BooleanNode(true) : new BooleanNode(builder.tcpNoDelay); throttling = new Throttling(builder.throttling, throwIfUninitialized); ssl = new Ssl(builder.ssl, throwIfUninitialized);
JDiscServerConnector(ConnectorConfig config, Metric metric, Server server, ServerSocketChannel channelOpenedByActivator, ConnectionFactory... factories) { super(server, factories); this.channelOpenedByActivator = channelOpenedByActivator; this.tcpKeepAlive = config.tcpKeepAliveEnabled(); this.tcpNoDelay = config.tcpNoDelay(); this.metric = metric; this.connectorName = config.name(); this.listenPort = config.listenPort(); this.metricCtx = metric.createContext(createConnectorDimensions(listenPort, connectorName)); this.statistics = new ServerConnectionStatistics(); addBean(statistics); ConnectorConfig.Throttling throttlingConfig = config.throttling(); if (throttlingConfig.enabled()) { new ConnectionThrottler(this, throttlingConfig).registerWithConnector(); } }
public Throttling build() { return new Throttling(this); }
public Builder(Throttling config) { enabled(config.enabled()); maxConnections(config.maxConnections()); maxHeapUtilization(config.maxHeapUtilization()); maxAcceptRate(config.maxAcceptRate()); idleTimeout(config.idleTimeout()); }