org.eclipse.jetty.util.thread.Scheduler Java Examples

The following examples show how to use org.eclipse.jetty.util.thread.Scheduler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionThrottler.java    From vespa with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: InstrumentedHttpConnectorFactory.java    From emodb with Apache License 2.0 5 votes vote down vote up
@Override
protected ServerConnector buildConnector(Server server,
                                         Scheduler scheduler,
                                         ByteBufferPool bufferPool,
                                         String name,
                                         ThreadPool threadPool,
                                         ConnectionFactory... factories) {
    // Intercept any buildConnector() calls and wrap the provided ConnectionFactory instances with our InstrumentedConnectionFactoryWrapper
    InstrumentedConnectionFactoryWrapper connectionFactoryWrappers[] = new InstrumentedConnectionFactoryWrapper[factories.length];
    for (int i = 0; i < factories.length; ++i) {
        connectionFactoryWrappers[i] = new InstrumentedConnectionFactoryWrapper(factories[i], _metricRegistry.get(), getBindHost(), getPort());
    }

    return super.buildConnector(server, scheduler, bufferPool, name, threadPool, connectionFactoryWrappers);
}
 
Example #3
Source File: JettyService.java    From armeria with Apache License 2.0 5 votes vote down vote up
ArmeriaEndPoint(@Nullable String hostname, Scheduler scheduler,
                SocketAddress local, SocketAddress remote) {
    super(scheduler);

    localAddress = addHostname((InetSocketAddress) local, hostname);
    remoteAddress = (InetSocketAddress) remote;

    setIdleTimeout(getIdleTimeout());
}
 
Example #4
Source File: JettyResourceFactory.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Return the configured {@link Scheduler}.
 */
@Nullable
public Scheduler getScheduler() {
	return this.scheduler;
}
 
Example #5
Source File: JettyResourceFactory.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Return the configured {@link Scheduler}.
 */
@Nullable
public Scheduler getScheduler() {
	return this.scheduler;
}
 
Example #6
Source File: JettyResourceFactory.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure the {@link Scheduler} to use.
 * <p>By default, initialized with a {@link ScheduledExecutorScheduler}.
 * @param scheduler the {@link Scheduler} to use
 */
public void setScheduler(@Nullable Scheduler scheduler) {
	this.scheduler = scheduler;
}
 
Example #7
Source File: JettyResourceFactory.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Configure the {@link Scheduler} to use.
 * <p>By default, initialized with a {@link ScheduledExecutorScheduler}.
 * @param scheduler the {@link Scheduler} to use
 */
public void setScheduler(@Nullable Scheduler scheduler) {
	this.scheduler = scheduler;
}