@Override protected IdentifiedDataSerializable getConfig() { ExecutorConfig config = new ExecutorConfig(parameters.name, parameters.poolSize); config.setQueueCapacity(parameters.queueCapacity); config.setStatisticsEnabled(parameters.statisticsEnabled); return config; }
/** * Sets the map of executor configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param executorConfigs the executor configuration map to set * @return this config instance */ public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) { this.executorConfigs.clear(); this.executorConfigs.putAll(executorConfigs); for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
@Override public Config addExecutorConfig(ExecutorConfig executorConfig) { ClientMessage request = DynamicConfigAddExecutorConfigCodec.encodeRequest( executorConfig.getName(), executorConfig.getPoolSize(), executorConfig.getQueueCapacity(), executorConfig.isStatisticsEnabled(), executorConfig.getQuorumName()); invoke(request); return this; }
@Override public ManagedExecutorService createNew(String name) { ExecutorConfig config = nodeEngine.getConfig().findExecutorConfig(name); int queueCapacity = config.getQueueCapacity() <= 0 ? Integer.MAX_VALUE : config.getQueueCapacity(); return createExecutor(name, config.getPoolSize(), queueCapacity, ExecutorType.CACHED); } };
private static Config createConfiguration() { Config config = new Config(); NetworkConfig networkCfg = createNetworkConfigs(); config.setNetworkConfig(networkCfg); ExecutorConfig executorConfig = new ExecutorConfig(); executorConfig.setPoolSize(MAX_POOL_SIZE); executorConfig.setStatisticsEnabled(false); config.addExecutorConfig(executorConfig); return config; }
.addExecutorConfig(new ExecutorConfig() .setName(taskDistributorName) .setPoolSize(1) );
/** * Starts the test application. * <p> * Loads the config from classpath hazelcast.xml, if it fails to load, will use default config. */ public static void main(String[] args) throws Exception { Config config; try { config = new FileSystemXmlConfig("hazelcast.xml"); } catch (FileNotFoundException e) { config = new Config(); } for (int i = 1; i <= LOAD_EXECUTORS_COUNT; i++) { config.addExecutorConfig(new ExecutorConfig(EXECUTOR_NAMESPACE + " " + i).setPoolSize(i)); } ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(config)); consoleApp.start(); } }
@Override public IdentifiedDataSerializable createNew(Integer arg) { return new ExecutorConfig(); } };
/** * Adds the executor configuration. The configuration is saved under * the config name, which may be a pattern with which the configuration * will be obtained in the future. * * @param executorConfig executor config to add * @return this config instance */ public Config addExecutorConfig(ExecutorConfig executorConfig) { this.executorConfigs.put(executorConfig.getName(), executorConfig); return this; }
private int handleExecutorService(MemberStateImpl memberState, int count, Config config, Map<String, LocalExecutorStats> executorServices) { for (Map.Entry<String, LocalExecutorStats> entry : executorServices.entrySet()) { String name = entry.getKey(); if (config.findExecutorConfig(name).isStatisticsEnabled()) { LocalExecutorStats stats = entry.getValue(); memberState.putLocalExecutorStats(name, stats); ++count; } } return count; }
@Override public ExecutorConfig findExecutorConfig(String name) { return getExecutorConfigInternal(name, "default").getAsReadOnly(); }
@Override public Object createNew(String name) { ExecutorConfig executorConfig = nodeEngine.getConfig().findExecutorConfig(name); String quorumName = executorConfig.getQuorumName(); return quorumName == null ? NULL_OBJECT : quorumName; } };
/** * Starts the test application. * <p> * Loads the config from classpath hazelcast.xml, if it fails to load, will use default config. */ public static void main(String[] args) throws Exception { Config config; try { config = new FileSystemXmlConfig("hazelcast.xml"); } catch (FileNotFoundException e) { config = new Config(); } for (int i = 1; i <= LOAD_EXECUTORS_COUNT; i++) { config.addExecutorConfig(new ExecutorConfig(EXECUTOR_NAMESPACE + " " + i).setPoolSize(i)); } ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(config)); consoleApp.start(); } }
@Override public ManagedExecutorService createNew(String name) { ExecutorConfig config = nodeEngine.getConfig().findExecutorConfig(name); int queueCapacity = config.getQueueCapacity() <= 0 ? Integer.MAX_VALUE : config.getQueueCapacity(); return createExecutor(name, config.getPoolSize(), queueCapacity, ExecutorType.CACHED); } };
@Override public IdentifiedDataSerializable createNew(Integer arg) { return new ExecutorConfig(); } };
/** * Adds the executor configuration. The configuration is saved under * the config name, which may be a pattern with which the configuration * will be obtained in the future. * * @param executorConfig executor config to add * @return this config instance */ public Config addExecutorConfig(ExecutorConfig executorConfig) { this.executorConfigs.put(executorConfig.getName(), executorConfig); return this; }
private int handleExecutorService(MemberStateImpl memberState, int count, Config config, Map<String, LocalExecutorStats> executorServices) { for (Map.Entry<String, LocalExecutorStats> entry : executorServices.entrySet()) { String name = entry.getKey(); if (config.findExecutorConfig(name).isStatisticsEnabled()) { LocalExecutorStats stats = entry.getValue(); memberState.putLocalExecutorStats(name, stats); ++count; } } return count; }
@Override public ExecutorConfig findExecutorConfig(String name) { return getExecutorConfigInternal(name, "default").getAsReadOnly(); }
@Override public Object createNew(String name) { ExecutorConfig executorConfig = nodeEngine.getConfig().findExecutorConfig(name); String quorumName = executorConfig.getQuorumName(); return quorumName == null ? NULL_OBJECT : quorumName; } };
@Override public Config addExecutorConfig(ExecutorConfig executorConfig) { ClientMessage request = DynamicConfigAddExecutorConfigCodec.encodeRequest( executorConfig.getName(), executorConfig.getPoolSize(), executorConfig.getQueueCapacity(), executorConfig.isStatisticsEnabled(), executorConfig.getQuorumName()); invoke(request); return this; }