@Override
  public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {

    final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
    final int coresCount = Runtime.getRuntime().availableProcessors();
    config.setPoolName("Grizzly-worker");
    config.setCorePoolSize(coresCount * 2);
    config.setMaxPoolSize(coresCount * 2);
    config.setMemoryManager(transport.getMemoryManager());
    return config;
  }
Beispiel #2
0
  @SuppressWarnings("unchecked")
  private void configureMonitoring(final NetworkListener listener) {
    final Transport transport = listener.getTransport();

    final MonitoringConfig<TransportProbe> transportMonitoringCfg = transport.getMonitoringConfig();
    final MonitoringConfig<ConnectionProbe> connectionMonitoringCfg =
        transport.getConnectionMonitoringConfig();
    final MonitoringConfig<MemoryProbe> memoryMonitoringCfg =
        transport.getMemoryManager().getMonitoringConfig();
    final MonitoringConfig<ThreadPoolProbe> threadPoolMonitoringCfg =
        transport.getThreadPoolMonitoringConfig();

    transportMonitoringCfg.addProbes(
        serverConfig.getMonitoringConfig().getTransportConfig().getProbes());
    connectionMonitoringCfg.addProbes(
        serverConfig.getMonitoringConfig().getConnectionConfig().getProbes());
    memoryMonitoringCfg.addProbes(serverConfig.getMonitoringConfig().getMemoryConfig().getProbes());
    threadPoolMonitoringCfg.addProbes(
        serverConfig.getMonitoringConfig().getThreadPoolConfig().getProbes());
  }