Java 类org.eclipse.jetty.server.LowResourceMonitor 实例源码

项目:polygene-java    文件:JettyConfigurationHelper.java   
static void configureServer( Server server, JettyConfiguration config )
{
    // Shutdown
    Integer gracefullShudownTimeout = config.gracefullShutdownTimeout().get();
    if( gracefullShudownTimeout != null )
    {
        server.setStopTimeout( gracefullShudownTimeout );
    }

    // Low resource max idle time
    Integer lowResourceMaxIdleTime = config.lowResourceMaxIdleTime().get();
    if( lowResourceMaxIdleTime != null )
    {
        LowResourceMonitor lowResourceMonitor = new LowResourceMonitor( server );
        lowResourceMonitor.setLowResourcesIdleTimeout( lowResourceMaxIdleTime );
        server.addBean( lowResourceMonitor );
    }

    // Statistics
    if( config.statistics().get() )
    {
        server.addBean( new ConnectorStatistics() );
    }
}
项目:restlet-jetty9    文件:JettyServerHelper.java   
/**
 * Creates a Jetty low resource monitor.
 * 
 * @param server
 *        A Jetty server.
 * @return A Jetty low resource monitor or null.
 */
private LowResourceMonitor createLowResourceMonitor( org.eclipse.jetty.server.Server server )
{
    final int period = getLowResourceMonitorPeriod();
    if( period > 0 )
    {
        final LowResourceMonitor lowResourceMonitor = new LowResourceMonitor( server );
        lowResourceMonitor.setMonitoredConnectors( Arrays.asList( server.getConnectors() ) );
        lowResourceMonitor.setPeriod( period );
        lowResourceMonitor.setMonitorThreads( getLowResourceMonitorThreads() );
        lowResourceMonitor.setMaxConnections( getLowResourceMonitorMaxConnections() );
        lowResourceMonitor.setMaxMemory( getLowResourceMonitorMaxMemory() );
        lowResourceMonitor.setMaxLowResourcesTime( getLowResourceMonitorMaxTime() );
        lowResourceMonitor.setLowResourcesIdleTimeout( getLowResourceMonitorIdleTimeout() );
        lowResourceMonitor.setStopTimeout( getLowResourceMonitorStopTimeout() );
        server.addBean( lowResourceMonitor );
        return lowResourceMonitor;
    }
    return null;
}
项目:xlator    文件:JettyConfig.java   
protected void configureLowResourceMonitor(Server server) {
    // monitor low resources
    LowResourceMonitor lowResourcesMonitor = new LowResourceMonitor(server);
    lowResourcesMonitor.setPeriod(jettyLowResourceMonitorSettings.getPeriod());
    lowResourcesMonitor.setLowResourcesIdleTimeout(jettyLowResourceMonitorSettings.getIdleTimeout());
    lowResourcesMonitor.setMonitorThreads(jettyLowResourceMonitorSettings.isMonitorThreads());
    lowResourcesMonitor.setMaxConnections(jettyLowResourceMonitorSettings.getMaxConnections());
    lowResourcesMonitor.setMaxMemory(jettyLowResourceMonitorSettings.getMaxMemory());
    lowResourcesMonitor.setMaxLowResourcesTime(jettyLowResourceMonitorSettings.getMaxLowResourcesTime());
    server.addBean(lowResourcesMonitor);
}