File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
plugins/discovery-ec2/src
main/java/org/elasticsearch/discovery/ec2
test/java/org/elasticsearch/discovery/ec2 Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 53
53
import static org .elasticsearch .discovery .ec2 .AwsEc2Service .HostType .TAG_PREFIX ;
54
54
55
55
class AwsEc2SeedHostsProvider implements SeedHostsProvider {
56
-
56
+
57
57
private static final Logger logger = LogManager .getLogger (AwsEc2SeedHostsProvider .class );
58
58
59
59
private final TransportService transportService ;
@@ -221,22 +221,13 @@ private DescribeInstancesRequest buildDescribeInstancesRequest() {
221
221
222
222
private final class TransportAddressesCache extends SingleObjectCache <List <TransportAddress >> {
223
223
224
- private boolean empty = true ;
225
-
226
224
protected TransportAddressesCache (TimeValue refreshInterval ) {
227
225
super (refreshInterval , new ArrayList <>());
228
226
}
229
227
230
- @ Override
231
- protected boolean needsRefresh () {
232
- return (empty || super .needsRefresh ());
233
- }
234
-
235
228
@ Override
236
229
protected List <TransportAddress > refresh () {
237
- final List <TransportAddress > nodes = fetchDynamicNodes ();
238
- empty = nodes .isEmpty ();
239
- return nodes ;
230
+ return fetchDynamicNodes ();
240
231
}
241
232
}
242
233
}
Original file line number Diff line number Diff line change @@ -306,10 +306,10 @@ protected List<TransportAddress> fetchDynamicNodes() {
306
306
return new ArrayList <>();
307
307
}
308
308
};
309
- for (int i = 0 ; i < 3 ; i ++) {
309
+ for (int i = 0 ; i < 3 ; i ++) {
310
310
provider .getSeedAddresses (null );
311
311
}
312
- assertThat (provider .fetchCount , is (3 ));
312
+ assertThat (provider .fetchCount , is (1 ));
313
313
}
314
314
315
315
public void testGetNodeListCached () throws Exception {
You can’t perform that action at this time.
0 commit comments