16
16
import java .util .Optional ;
17
17
import java .util .Set ;
18
18
import java .util .concurrent .CompletableFuture ;
19
- import java .util .concurrent .TimeUnit ;
20
19
import java .util .stream .Collectors ;
21
20
22
21
import org .apache .logging .log4j .LogManager ;
@@ -292,26 +291,19 @@ private void registerRequestHandler(DynamicActionRegistry dynamicActionRegistry)
292
291
* @param extension The extension to be loaded
293
292
*/
294
293
public void loadExtension (Extension extension ) throws IOException {
295
- try {
296
- validateExtension (extension );
297
- DiscoveryExtensionNode discoveryExtensionNode = new DiscoveryExtensionNode (
298
- extension .getName (),
299
- extension .getUniqueId (),
300
- new TransportAddress (InetAddress .getByName (extension .getHostAddress ()), Integer .parseInt (extension .getPort ())),
301
- new HashMap <String , String >(),
302
- Version .fromString (extension .getOpensearchVersion ()),
303
- Version .fromString (extension .getMinimumCompatibleVersion ()),
304
- extension .getDependencies ()
305
- );
306
- extensionIdMap .put (extension .getUniqueId (), discoveryExtensionNode );
307
- extensionSettingsMap .put (extension .getUniqueId (), extension );
308
- logger .info ("Loaded extension with uniqueId " + extension .getUniqueId () + ": " + extension );
309
- } catch (IOException e ) {
310
- throw e ;
311
- } catch (IllegalArgumentException e ) {
312
- throw e ;
313
- }
314
-
294
+ validateExtension (extension );
295
+ DiscoveryExtensionNode discoveryExtensionNode = new DiscoveryExtensionNode (
296
+ extension .getName (),
297
+ extension .getUniqueId (),
298
+ new TransportAddress (InetAddress .getByName (extension .getHostAddress ()), Integer .parseInt (extension .getPort ())),
299
+ new HashMap <String , String >(),
300
+ Version .fromString (extension .getOpensearchVersion ()),
301
+ Version .fromString (extension .getMinimumCompatibleVersion ()),
302
+ extension .getDependencies ()
303
+ );
304
+ extensionIdMap .put (extension .getUniqueId (), discoveryExtensionNode );
305
+ extensionSettingsMap .put (extension .getUniqueId (), extension );
306
+ logger .info ("Loaded extension with uniqueId " + extension .getUniqueId () + ": " + extension );
315
307
}
316
308
317
309
private void validateField (String fieldName , String value ) throws IOException {
@@ -329,7 +321,7 @@ private void validateExtension(Extension extension) throws IOException {
329
321
validateField ("opensearch version" , extension .getOpensearchVersion ());
330
322
validateField ("minimum opensearch version" , extension .getMinimumCompatibleVersion ());
331
323
if (extensionIdMap .containsKey (extension .getUniqueId ())) {
332
- throw new IOException ("Duplicate uniqueId " + extension .getUniqueId () + ". Did not load extension: " + extension );
324
+ throw new IOException ("Duplicate uniqueId [ " + extension .getUniqueId () + "] . Did not load extension: " + extension );
333
325
}
334
326
}
335
327
@@ -404,7 +396,6 @@ protected void doRun() throws Exception {
404
396
new InitializeExtensionRequest (transportService .getLocalNode (), extension ),
405
397
initializeExtensionResponseHandler
406
398
);
407
- inProgressFuture .orTimeout (EXTENSION_REQUEST_WAIT_TIMEOUT , TimeUnit .SECONDS ).join ();
408
399
}
409
400
});
410
401
}
0 commit comments