20
20
import java .util .HashSet ;
21
21
import java .util .concurrent .TimeoutException ;
22
22
23
+ /**
24
+ * Utilities for identifying timeouts in responses to collection requests, since we prefer to fail the whole collection attempt if any of
25
+ * the involved nodes times out.
26
+ */
23
27
public final class TimeoutUtils {
24
28
private TimeoutUtils () {
25
29
}
26
30
31
+ /**
32
+ * @throws ElasticsearchTimeoutException iff the {@code response} contains any node-level timeout. The exception message identifies the
33
+ * nodes that timed out and mentions {@code collectionTimeout}.
34
+ */
27
35
public static <T extends BaseNodeResponse > void ensureNoTimeouts (TimeValue collectionTimeout , BaseNodesResponse <T > response ) {
28
36
HashSet <String > timedOutNodeIds = null ;
29
37
for (FailedNodeException failedNodeException : response .failures ()) {
@@ -37,6 +45,10 @@ public static <T extends BaseNodeResponse> void ensureNoTimeouts(TimeValue colle
37
45
ensureNoTimeouts (collectionTimeout , timedOutNodeIds );
38
46
}
39
47
48
+ /**
49
+ * @throws ElasticsearchTimeoutException iff the {@code response} contains any node-level timeout. The exception message identifies the
50
+ * nodes that timed out and mentions {@code collectionTimeout}.
51
+ */
40
52
public static void ensureNoTimeouts (TimeValue collectionTimeout , BaseTasksResponse response ) {
41
53
HashSet <String > timedOutNodeIds = null ;
42
54
for (ElasticsearchException nodeFailure : response .getNodeFailures ()) {
@@ -53,6 +65,10 @@ public static void ensureNoTimeouts(TimeValue collectionTimeout, BaseTasksRespon
53
65
ensureNoTimeouts (collectionTimeout , timedOutNodeIds );
54
66
}
55
67
68
+ /**
69
+ * @throws ElasticsearchTimeoutException iff the {@code response} contains any node-level timeout. The exception message identifies the
70
+ * nodes that timed out and mentions {@code collectionTimeout}.
71
+ */
56
72
public static void ensureNoTimeouts (TimeValue collectionTimeout , BroadcastResponse response ) {
57
73
HashSet <String > timedOutNodeIds = null ;
58
74
for (DefaultShardOperationFailedException shardFailure : response .getShardFailures ()) {
0 commit comments