@Override public Long convert(String value) { return ConfigurationTypeHelper.getTimeInMillis(value); } }
@Override public int getZooKeepersSessionTimeOut() { return (int) ConfigurationTypeHelper .getTimeInMillis(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT.getValue(properties)); }
private static Long getDefaultTimeout() { Long def = ConfigurationTypeHelper.getTimeInMillis(BATCH_WRITER_TIMEOUT_MAX.getDefaultValue()); if (def.equals(0L)) return Long.MAX_VALUE; else return def; }
protected long getTimeout(final CommandLine cl) { if (cl.hasOption(timeoutOption.getLongOpt())) { return ConfigurationTypeHelper.getTimeInMillis(cl.getOptionValue(timeoutOption.getLongOpt())); } return Long.MAX_VALUE; }
protected long getTimeout(final CommandLine cl) { if (cl.hasOption(timeoutOption.getLongOpt())) { return ConfigurationTypeHelper.getTimeInMillis(cl.getOptionValue(timeoutOption.getLongOpt())); } return Long.MAX_VALUE; }
protected long getTimeout(final CommandLine cl) { if (cl.hasOption(timeoutOption.getLongOpt())) { return ConfigurationTypeHelper.getTimeInMillis(cl.getOptionValue(timeoutOption.getLongOpt())); } return Long.MAX_VALUE; }
public Long getTimeInMillis(Properties properties) { String value = getValue(properties); if (value.isEmpty()) { return null; } checkState(getType() == PropertyType.TIMEDURATION, "Invalid type getting time. Type must be " + PropertyType.TIMEDURATION + ", not " + getType()); return ConfigurationTypeHelper.getTimeInMillis(value); }
/** * Gets a property of type {@link PropertyType#TIMEDURATION}, interpreting the value properly. * * @param property * property to get * @return property value * @throws IllegalArgumentException * if the property is of the wrong type */ public long getTimeInMillis(Property property) { checkType(property, PropertyType.TIMEDURATION); return ConfigurationTypeHelper.getTimeInMillis(get(property)); }
@Override protected long getWaitTime() { Map<String,String> customProps = context.getServerConfFactory().getTableConfiguration(tableId) .getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); if (customProps.containsKey(WAIT_TIME_PROPERTY)) { return ConfigurationTypeHelper.getTimeInMillis(customProps.get(WAIT_TIME_PROPERTY)); } return super.getWaitTime(); }
oobCheckMillis = ConfigurationTypeHelper.getTimeInMillis(oobProperty);
private static void checkTimeDuration(Property prop, String value, CheckTimeDuration chk) { verifyPropertyTypes(PropertyType.TIMEDURATION, prop); if (!chk.check(ConfigurationTypeHelper.getTimeInMillis(value))) fatal(PREFIX + chk.getDescription(prop)); }
ZooKeeperInstance(ClientConfiguration config, ZooCacheFactory zcf) { checkArgument(config != null, "config is null"); // Enable singletons before before getting a zoocache SingletonManager.setMode(Mode.CONNECTOR); this.clientConf = config; this.instanceId = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ID); this.instanceName = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_NAME); if ((instanceId == null) == (instanceName == null)) throw new IllegalArgumentException( "Expected exactly one of instanceName and instanceId to be set; " + (instanceName == null ? "neither" : "both") + " were set"); this.zooKeepers = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST); this.zooKeepersSessionTimeOut = (int) ConfigurationTypeHelper .getTimeInMillis(clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT)); zooCache = zcf.getZooCache(zooKeepers, zooKeepersSessionTimeOut); if (instanceName != null) { // Validates that the provided instanceName actually exists getInstanceID(); } }
/** * Enable tracing by setting up SpanReceivers for the current process. If host name is null, it * will be determined. If service name is null, the simple name of the class will be used. * Properties required in the client configuration include * {@link org.apache.accumulo.core.conf.ClientProperty#TRACE_SPAN_RECEIVERS} and any properties * specific to the span receiver. */ public static void enable(String hostname, String service, Properties properties) { String spanReceivers = ClientProperty.TRACE_SPAN_RECEIVERS.getValue(properties); String zookeepers = ClientProperty.INSTANCE_ZOOKEEPERS.getValue(properties); long timeout = ConfigurationTypeHelper .getTimeInMillis(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT.getValue(properties)); String zkPath = ClientProperty.TRACE_ZOOKEEPER_PATH.getValue(properties); Map<String,String> props = ClientProperty .toMap(ClientProperty.getPrefix(properties, ClientProperty.TRACE_SPAN_RECEIVER_PREFIX)); enableTracing(hostname, service, spanReceivers, zookeepers, timeout, zkPath, props); }