public void init(Configuration cfg) { if (cfg.containsKey(CORE_POOL_SIZE_KEY)) { _corePoolSize = cfg.getInt(CORE_POOL_SIZE_KEY); } if (cfg.containsKey(MAX_POOL_SIZE_KEY)) { _maxPoolSize = cfg.getInt(MAX_POOL_SIZE_KEY); } if (cfg.containsKey(IDLE_TIMEOUT_MS_KEY)) { _idleTimeoutMs = cfg.getLong(IDLE_TIMEOUT_MS_KEY); } }
public NettyServerConfig(Configuration serverNettyConfig) throws ConfigurationException { _serverNettyConfig = serverNettyConfig; if (!_serverNettyConfig.containsKey(NETTY_SERVER_PORT)) { throw new ConfigurationException("Cannot find Key : " + NETTY_SERVER_PORT); } }
private void checkRequiredKeys() throws ConfigurationException { for (String keyString : REQUIRED_KEYS) { if (!_queryPlannerConfig.containsKey(keyString)) { throw new ConfigurationException("Cannot find required key : " + keyString); } } }
private void checkRequiredKeys() throws ConfigurationException { for (String keyString : REQUIRED_KEYS) { if (!_queryExecutorConfig.containsKey(keyString)) { throw new ConfigurationException("Cannot find required key : " + keyString); } } }
private void checkRequiredKeys() throws ConfigurationException { for (String keyString : REQUIRED_KEYS) { if (!_segmentPrunerSetConfig.containsKey(keyString)) { throw new ConfigurationException("Cannot find required key : " + keyString); } } }
private void checkRequiredKeys() throws ConfigurationException { for (String keyString : REQUIRED_KEYS) { if (!_instanceDataManagerConfiguration.containsKey(keyString)) { throw new ConfigurationException("Cannot find required key : " + keyString); } } }
@Override public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore, BrokerMetrics brokerMetrics) { super.init(configuration, tableConfig, propertyStore, brokerMetrics); // TODO jfim This is a broker-level configuration for now, until we refactor the configuration of the routing table to allow per-table routing settings if (configuration.containsKey("realtimeTargetServerCountPerQuery")) { final String targetServerCountPerQuery = configuration.getString("realtimeTargetServerCountPerQuery"); try { _targetNumServersPerQuery = Integer.parseInt(targetServerCountPerQuery); LOGGER.info("Using realtime target server count of {}", _targetNumServersPerQuery); } catch (Exception e) { LOGGER.warn( "Could not get the realtime target server count per query from configuration value {}, keeping default value {}", targetServerCountPerQuery, _targetNumServersPerQuery, e); } } else { LOGGER.info("Using default value for realtime target server count of {}", _targetNumServersPerQuery); } }
@Override public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore, BrokerMetrics brokerMetrics) { super.init(configuration, tableConfig, propertyStore, brokerMetrics); // TODO jfim This is a broker-level configuration for now, until we refactor the configuration of the routing table to allow per-table routing settings if (configuration.containsKey("offlineTargetServerCountPerQuery")) { final String targetServerCountPerQuery = configuration.getString("offlineTargetServerCountPerQuery"); try { _targetNumServersPerQuery = Integer.parseInt(targetServerCountPerQuery); LOGGER.info("Using offline target server count of {}", _targetNumServersPerQuery); } catch (Exception e) { LOGGER.warn( "Could not get the offline target server count per query from configuration value {}, keeping default value {}", targetServerCountPerQuery, _targetNumServersPerQuery, e); } } else { LOGGER.info("Using default value for offline target server count of {}", _targetNumServersPerQuery); } }
public void init(Configuration cfg) { if (cfg.containsKey(THREAD_POOL_KEY)) { _threadPool.init(cfg.subset(THREAD_POOL_KEY)); if (cfg.containsKey(IDLE_TIMEOUT_MS_KEY)) { _idleTimeoutMs = cfg.getLong(IDLE_TIMEOUT_MS_KEY); if (cfg.containsKey(MIN_CONNECTIONS_PER_SERVER_KEY)) { _minConnectionsPerServer = cfg.getInt(MIN_CONNECTIONS_PER_SERVER_KEY); if (cfg.containsKey(MAX_CONNECTIONS_PER_SERVER_KEY)) { _maxConnectionsPerServer = cfg.getInt(MAX_CONNECTIONS_PER_SERVER_KEY); if (cfg.containsKey(MAX_BACKLOG_PER_SERVER_KEY)) { _maxBacklogPerServer = cfg.getInt(MAX_BACKLOG_PER_SERVER_KEY);
/** * Update template configuration by updating supplied existing properties and adding new ones to the * {@link Configuration}; your updated Configuration may not contain the property "graph.graphname"; * NOTE: Any graph using a configuration that was created using the template configuration must-- * 1) be closed and reopened on every JanusGraph Node 2) have its corresponding Configuration removed * and 3) recreate the graph-- before the update is guaranteed to take effect. */ public void updateTemplateConfiguration(final Configuration config) { Preconditions.checkArgument(!config.containsKey(PROPERTY_GRAPH_NAME), String.format("Your updated template configuration may not contain the property \"%s\".", PROPERTY_GRAPH_NAME )); log.warn("Any graph configuration created using the template configuration are only guaranteed to have their configuration updated " + "according to this new template configuration when the graph in question has been closed on every Janus Graph Node, its " + "corresponding Configuration has been removed, and the graph has been recreated."); updateVertexWithProperties(PROPERTY_TEMPLATE, true, ConfigurationConverter.getMap(config)); }
/** * Update configuration corresponding to supplied graphName; we update supplied existing * properties and add new ones to the {@link Configuration}; The supplied {@link Configuration} must include a * property "graph.graphname" and it must match supplied graphName; * NOTE: The updated configuration is only guaranteed to take effect if the {@link Graph} corresponding to * graphName has been closed and reopened on every JanusGraph Node. */ public void updateConfiguration(final String graphName, final Configuration config) { final Map<Object, Object> map = ConfigurationConverter.getMap(config); if (config.containsKey(PROPERTY_GRAPH_NAME)) { final String graphNameOnConfig = (String) map.get(PROPERTY_GRAPH_NAME); Preconditions.checkArgument(graphName.equals(graphNameOnConfig), String.format("Supplied graphName %s does not match property value supplied on config: %s.", graphName, graphNameOnConfig )); } else { map.put(PROPERTY_GRAPH_NAME, graphName); } log.warn("Configuration {} is only guaranteed to take effect when graph {} has been closed and reopened on all Janus Graph Nodes.", graphName, graphName ); updateVertexWithProperties(PROPERTY_GRAPH_NAME, graphName, map); }
@Override public void init(Configuration config) { Assert.assertTrue(config.containsKey(CONFIG_SUBSET_KEY)); Assert.assertTrue(config.getString(CONFIG_SUBSET_KEY).equalsIgnoreCase(SAMPLE_KEYMAP_VAL)); }
_largeClusterRoutingTableBuilder = new LargeClusterRoutingTableBuilder(); _smallClusterRoutingTableBuilder = new BalancedRandomRoutingTableBuilder(); if (configuration.containsKey("minServerCountForLargeCluster")) { final String minServerCountForLargeCluster = configuration.getString("minServerCountForLargeCluster"); try { if (configuration.containsKey("minReplicaCountForLargeCluster")) { final String minReplicaCountForLargeCluster = configuration.getString("minReplicaCountForLargeCluster"); try {
@Override public<O> O get(String key, Class<O> datatype) { if (!config.containsKey(key)) return null;
@Override public<O> O get(String key, Class<O> dataType) { if (!config.containsKey(key)) return null;
public void init(Configuration cfg) { if (cfg.containsKey(ROUTING_MODE_KEY)) { _routingMode = RoutingMode.valueOf(cfg.getString(ROUTING_MODE_KEY)); } if ((_routingMode == RoutingMode.CONFIG)) { _cfgBasedRouting.init(cfg.subset(CFG_BASED_ROUTING)); } Configuration connPoolCfg = cfg.subset(CONNECTION_POOL_CONFIG); if (connPoolCfg != null) { _connPool.init(connPoolCfg); } }
/** * Create a configuration according to the supplied {@link Configuration}; you must include * the property "graph.graphname" with a value in the configuration; you can then * open your graph using graph.graphname without having to supply the * Configuration or File each time using the {@link org.janusgraph.core.ConfiguredGraphFactory}. */ public void createConfiguration(final Configuration config) { Preconditions.checkArgument(config.containsKey(PROPERTY_GRAPH_NAME), String.format("Please include the property \"%s\" in your configuration.", PROPERTY_GRAPH_NAME )); final Map<Object, Object> map = ConfigurationConverter.getMap(config); final Vertex v = graph.addVertex(T.label, VERTEX_LABEL); map.forEach((key, value) -> v.property((String) key, value)); v.property(PROPERTY_TEMPLATE, false); graph.tx().commit(); }
/** * Create a template configuration according to the supplied {@link Configuration}; if * you already created a template configuration or the supplied {@link Configuration} * contains the property "graph.graphname", we throw a {@link RuntimeException}; you can then use * this template configuration to create a graph using the * ConfiguredGraphFactory create signature and supplying a new graphName. */ public void createTemplateConfiguration(final Configuration config) { Preconditions.checkArgument(!config.containsKey(PROPERTY_GRAPH_NAME), String.format("Your template configuration may not contain the property \"%s\".", PROPERTY_GRAPH_NAME )); Preconditions.checkState(null == getTemplateConfiguration(), "You may only have one template configuration and one exists already."); final Map<Object, Object> map = ConfigurationConverter.getMap(config); final Vertex v = graph.addVertex(); v.property(PROPERTY_TEMPLATE, true); map.forEach((key, value) -> v.property((String) key, value)); graph.tx().commit(); }
if (_helixServerConfig.containsKey(CommonConstants.Server.CONFIG_OF_INSTANCE_ID)) { _instanceId = _helixServerConfig.getString(CommonConstants.Server.CONFIG_OF_INSTANCE_ID); } else {
/** * This constructor is largely just for unit testing purposes and should not typically be used externally. */ DriverRemoteConnection(final Cluster cluster, final Configuration conf) { remoteTraversalSourceName = conf.getString(GREMLIN_REMOTE_DRIVER_SOURCENAME, DEFAULT_TRAVERSAL_SOURCE); attachElements = conf.containsKey(GREMLIN_REMOTE + "attachment"); client = cluster.connect(Client.Settings.build().create()).alias(remoteTraversalSourceName); tryCloseCluster = false; tryCloseClient = true; this.conf = Optional.of(conf); }