|
78 | 78 | * @author Andrea Di Cesare {@literal <andrea@softinstigate.com>} |
79 | 79 | */ |
80 | 80 | @RegisterPlugin( |
81 | | - name = "polyglotDeployer", |
82 | | - description = "handles GraalVM polyglot plugins", |
83 | | - enabledByDefault = true) |
| 81 | + name = "polyglotDeployer", |
| 82 | + description = "handles GraalVM polyglot plugins", |
| 83 | + enabledByDefault = true) |
84 | 84 | public class PolyglotDeployer implements Initializer { |
85 | 85 |
|
86 | 86 | private static final Logger LOGGER = LoggerFactory.getLogger(PolyglotDeployer.class); |
@@ -353,14 +353,18 @@ private List<Path> findDeclaredPlugins(final Path path, final String prop, final |
353 | 353 | if (checkPluginFiles) { |
354 | 354 | if (Files.isRegularFile(pluginPath)) { |
355 | 355 | try { |
356 | | - final var language = PolyglotClassloaderHelper.withPluginsClassloaderResult( |
357 | | - () -> Source.findLanguage(pluginPath.toFile())); |
| 356 | + // Source.findLanguage() touches Truffle internals; |
| 357 | + // this lambda may run on a virtual thread (file watcher), |
| 358 | + // so dispatch to a platform thread (see PolyglotThreadUtils) |
| 359 | + final var language = PolyglotThreadUtils.onPlatformThread( |
| 360 | + () -> PolyglotClassloaderHelper.withPluginsClassloaderResult( |
| 361 | + () -> Source.findLanguage(pluginPath.toFile()))); |
358 | 362 | if ("js".equals(language)) { |
359 | 363 | ret.add(pluginPath); |
360 | 364 | } else { |
361 | 365 | LOGGER.warn("{} is not javascript", pluginPath.toAbsolutePath()); |
362 | 366 | } |
363 | | - } catch (final IOException e) { |
| 367 | + } catch (final Exception e) { |
364 | 368 | LOGGER.warn("{} is not javascript", pluginPath.toAbsolutePath(), e); |
365 | 369 | } |
366 | 370 | } else { |
@@ -454,8 +458,8 @@ private void deployNodeService(final Path pluginPath) throws IOException { |
454 | 458 | DEPLOYEES.put(pluginPath.toAbsolutePath(), srv); |
455 | 459 |
|
456 | 460 | LOGGER.info(ansi().fg(GREEN).a( |
457 | | - "Service '{}' deployed at URI '{}' with description: '{}'. Secured: {}. Uri match policy: {}") |
458 | | - .reset().toString(), srv.name(), srv.uri(), srv.getDescription(), srv.secured(), |
| 461 | + "Service '{}' deployed at URI '{}' with description: '{}'. Secured: {}. Uri match policy: {}") |
| 462 | + .reset().toString(), srv.name(), srv.uri(), srv.getDescription(), srv.secured(), |
459 | 463 | srv.matchPolicy()); |
460 | 464 | } catch (IOException | InterruptedException | ExecutionException | TimeoutException ex) { |
461 | 465 | LOGGER.error("Error deploying node service {}", pluginPath, ex); |
|
0 commit comments