blob: b198668053289f4046e8e261c5193139e28c852b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi;
import java.time.Duration;
import java.util.Optional;
/**
* Parameters for creating a synchronous session
*
* @author bjorncs
* @author Simon Thoresen Hult
*/
public class SyncParameters extends Parameters {
private final Duration defaultTimeout;
/**
* @deprecated Use {@link Builder} instead.
*/
@Deprecated
// TODO Vespa 7: Make private
public SyncParameters() {
this(null);
}
private SyncParameters(Duration defaultTimeout) {
this.defaultTimeout = defaultTimeout;
}
public Optional<Duration> defaultTimeout() {
return Optional.ofNullable(defaultTimeout);
}
public static class Builder {
private Duration defaultTimeout;
/**
* Set default timeout for all messagebus operations.
*/
public void setDefaultTimeout(Duration defaultTimeout) {
this.defaultTimeout = defaultTimeout;
}
public SyncParameters build() {
return new SyncParameters(defaultTimeout);
}
}
}
|