1

Working with vertx.io 3.0.0, when an exception is thrown and not catch in the JAVA API the vertical freezes. We are working on a single server environment, the server is not in a cluster.

Any thoughts?

prasun
  • 7,073
  • 9
  • 41
  • 59
David Laberge
  • 15,435
  • 14
  • 53
  • 83

1 Answers1

2

You should catch the current thread's unhanded exception using:

Thread.currentThread().setUncaughtExceptionHandler(
     new Thread.UncaughtExceptionHandler() {
  public void uncaughtException(Thread t, Throwable e) {
     LOGGER.error(t + " throws exception: " + e);
  }
});

If you are using multiple vertical, I would recommend that you add UncaughtExceptionhandler for each vertical, as each vertical will have its own event loop and hence, its own thread.

There is a similar question for java already answered: Java uncaught global exception handler

Community
  • 1
  • 1
prasun
  • 7,073
  • 9
  • 41
  • 59