本文整理了Java中org.elasticsearch.common.unit.TimeValue.timeUnit()
方法的一些代码示例,展示了TimeValue.timeUnit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeValue.timeUnit()
方法的具体详情如下:
包路径:org.elasticsearch.common.unit.TimeValue
类名称:TimeValue
方法名:timeUnit
暂无
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Write a {@link TimeValue} to the stream
*/
public void writeTimeValue(TimeValue timeValue) throws IOException {
writeZLong(timeValue.duration());
writeByte(TIME_UNIT_BYTE_MAP.get(timeValue.timeUnit()));
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Acquire all primary operation permits. Once all permits are acquired, the provided ActionListener is called.
* It is the responsibility of the caller to close the {@link Releasable}.
*/
public void acquireAllPrimaryOperationsPermits(final ActionListener<Releasable> onPermitAcquired, final TimeValue timeout) {
verifyNotClosed();
assert shardRouting.primary() : "acquireAllPrimaryOperationsPermits should only be called on primary shard: " + shardRouting;
indexShardOperationPermits.asyncBlockOperations(onPermitAcquired, timeout.duration(), timeout.timeUnit());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Acquire all replica operation permits whenever the shard is ready for indexing (see
* {@link #acquireAllPrimaryOperationsPermits(ActionListener, TimeValue)}. If the given primary term is lower than then one in
* {@link #shardRouting}, the {@link ActionListener#onFailure(Exception)} method of the provided listener is invoked with an
* {@link IllegalStateException}.
*
* @param opPrimaryTerm the operation primary term
* @param globalCheckpoint the global checkpoint associated with the request
* @param maxSeqNoOfUpdatesOrDeletes the max seq_no of updates (index operations overwrite Lucene) or deletes captured on the primary
* after this replication request was executed on it (see {@link #getMaxSeqNoOfUpdatesOrDeletes()}
* @param onPermitAcquired the listener for permit acquisition
* @param timeout the maximum time to wait for the in-flight operations block
*/
public void acquireAllReplicaOperationsPermits(final long opPrimaryTerm,
final long globalCheckpoint,
final long maxSeqNoOfUpdatesOrDeletes,
final ActionListener<Releasable> onPermitAcquired,
final TimeValue timeout) {
innerAcquireReplicaOperationPermit(opPrimaryTerm, globalCheckpoint, maxSeqNoOfUpdatesOrDeletes, onPermitAcquired, true,
(listener) -> indexShardOperationPermits.asyncBlockOperations(listener, timeout.duration(), timeout.timeUnit()));
}
代码示例来源:origin: couchbase/couchbase-elasticsearch-connector
public static ConsulResponse<Value> getWithRetry(KeyValueClient kv, String key, BackoffPolicy backoffPolicy) throws TimeoutException {
final Iterator<TimeValue> retryDelays = backoffPolicy.iterator();
while (true) {
final ConsulResponse<Value> response = kv.getConsulResponseWithValue(key).orElse(null);
if (response != null) {
return response;
}
try {
if (!retryDelays.hasNext()) {
break;
}
final TimeValue retryDelay = retryDelays.next();
LOGGER.debug("Document does not exist; sleeping for {} and then trying again to get {}", retryDelay, key);
retryDelay.timeUnit().sleep(retryDelay.duration());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
throw new TimeoutException("getWithRetry timed out for key " + key);
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Write a {@link TimeValue} to the stream
*/
public void writeTimeValue(TimeValue timeValue) throws IOException {
writeZLong(timeValue.duration());
writeByte(TIME_UNIT_BYTE_MAP.get(timeValue.timeUnit()));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Write a {@link TimeValue} to the stream
*/
public void writeTimeValue(TimeValue timeValue) throws IOException {
writeZLong(timeValue.duration());
writeByte(TIME_UNIT_BYTE_MAP.get(timeValue.timeUnit()));
}
代码示例来源:origin: couchbase/couchbase-elasticsearch-connector
private static Slf4jReporter newSlf4jReporter(TimeValue logInterval) {
Slf4jReporter reporter = Slf4jReporter.forRegistry(Metrics.registry())
.convertDurationsTo(MILLISECONDS)
.convertRatesTo(SECONDS)
.outputTo(LoggerFactory.getLogger("cbes.metrics"))
.withLoggingLevel(Slf4jReporter.LoggingLevel.INFO)
.build();
if (logInterval.duration() > 0) {
reporter.start(logInterval.duration(), logInterval.duration(), logInterval.timeUnit());
}
return reporter;
}
代码示例来源:origin: couchbase/couchbase-elasticsearch-connector
public static Client newClient(CouchbaseConfig config, Supplier<KeyStore> keystore) {
//final Client.Builder builder = Client.configure()
final Client.Builder builder = newClientBuilderWithSupportForCustomBootstrapPort()
.connectTimeout(config.dcp().connectTimeout().millis())
.hostnames(config.hosts())
.bucket(config.bucket())
// .poolBuffers(true)
.username(config.username())
.password(config.password())
.controlParam(DcpControl.Names.ENABLE_NOOP, "true")
.controlParam(DcpControl.Names.SET_NOOP_INTERVAL, 20)
.compression(config.dcp().compression())
.mitigateRollbacks(
config.dcp().persistencePollingInterval().duration(),
config.dcp().persistencePollingInterval().timeUnit())
.flowControl(toIntOrDie(config.dcp().flowControlBuffer().getBytes()))
.bufferAckWatermark(60);
if (config.secureConnection()) {
builder.sslEnabled(true);
builder.sslKeystore(keystore.get());
}
return builder.build();
}
内容来源于网络,如有侵权,请联系作者删除!