Skip to content

Commit

Permalink
Expose unavailability cause to use native transport
Browse files Browse the repository at this point in the history
  • Loading branch information
franz1981 committed Feb 22, 2023
1 parent f80519d commit 51e7f77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,12 @@ default <T> Future<T> executeBlocking(Handler<Promise<T>> blockingCodeHandler) {
@CacheReturn
boolean isNativeTransportEnabled();

/**
* @return the error (if any) that cause the unavailability of native transport when {@link #isNativeTransportEnabled()} returns {@code false}.
*/
@CacheReturn
Throwable unavailableNativeTransportCause();

/**
* Set a default exception handler for {@link Context}, set on {@link Context#exceptionHandler(Handler)} at creation.
*
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/io/vertx/core/impl/VertxImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ public boolean isNativeTransportEnabled() {
return transport != Transport.JDK;
}

@Override
public Throwable unavailableNativeTransportCause() {
if (isNativeTransportEnabled()) {
return null;
}
return transport.unavailabilityCause();
}

public FileSystem fileSystem() {
return fileSystem;
}
Expand Down

0 comments on commit 51e7f77

Please sign in to comment.