You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by GitBox <gi...@apache.org> on 2020/08/20 17:27:36 UTC

[GitHub] [unomi] sergehuber commented on a change in pull request #186: Stop unomi when reactor error

sergehuber commented on a change in pull request #186:
URL: https://github.com/apache/unomi/pull/186#discussion_r474154325



##########
File path: persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
##########
@@ -2081,13 +2081,25 @@ public T executeInClassLoader(Object... args) throws Exception {
         public T catchingExecuteInClassLoader(boolean logError, Object... args) {
             try {
                 return executeInClassLoader(timerName, args);
-            } catch (Throwable t) {
-                if (logError) {
-                    logger.error("Error while executing in class loader", t);
+            } catch (IllegalStateException e) {
+                // Reactor stopped - recovery is not possible
+                if (e.getMessage().contains("I/O reactor status: STOPPED")) {
+                    logger.error("I/O Reactor stopped - stopping application");
+                    System.exit(-1);

Review comment:
       System.exit is really not recommended in an OSGi environment. It would be better to use the UnomiManagementService.stopUnomi method.
   
   Ideally we would add a way for the ElasticSearch persistence implementation to recover from a failing connection but that's a lot more involved in terms of work.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org