]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed Acorn MainProgram and GraphClientImpl2 to use Logger 75/2275/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 4 Oct 2018 05:21:50 +0000 (08:21 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 4 Oct 2018 05:21:50 +0000 (08:21 +0300)
Previously the t.printStackTrace() in MainProrgam.run caused an
unexpected error that killed MainProgram to go down the drain.

gitlab #141

Change-Id: If68244b0e0f029ca43bbc45159936d3d89e49262

bundles/org.simantics.acorn/src/org/simantics/acorn/GraphClientImpl2.java
bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java

index 2ffdc715ff2546db5e03e67e102858a2317b87ef..a0c2ef860ba0353b6a1eb7ea0feabe605efb2a63 100644 (file)
@@ -46,7 +46,6 @@ import org.simantics.db.server.ProCoreException;
 import org.simantics.db.service.ClusterSetsSupport;
 import org.simantics.db.service.ClusterUID;
 import org.simantics.db.service.LifecycleSupport;
-import org.simantics.utils.DataContainer;
 import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.logging.TimeLogger;
 import org.slf4j.Logger;
@@ -689,7 +688,7 @@ public class GraphClientImpl2 implements Database.Session {
                                                                LOGGER.info("performUndo " + ccsid);
                                                        performUndo(ccsid, clusterChanges, support);
                                                } catch (DatabaseException e) {
-                                                       e.printStackTrace();
+                                                       LOGGER.error("failed to perform undo for cluster change set {}", ccsid, e);
                                                }
                                        }
                                }
index 8dea16d7fe73a5cc0234a6e00998ad964f184513..ec4d56c211ad54640d6d6f429d8847e8d6bf7760 100644 (file)
@@ -61,6 +61,7 @@ public class MainProgram implements Runnable, Closeable {
                }
        }
 
+       @SuppressWarnings("unchecked")
        MainProgram(GraphClientImpl2 client, ClusterManager clusters) {
 
                this.client = client;
@@ -128,7 +129,7 @@ public class MainProgram implements Runnable, Closeable {
                                try {
                                        swapChunks();
                                } catch (AcornAccessVerificationException | IllegalAcornStateException e) {
-                                   e.printStackTrace();
+                                       LOGGER.error("cluster chunk swapping failed", e);
                                } finally {
                                        clusters.streamLRU.releaseMutex();
                                }
@@ -146,7 +147,7 @@ public class MainProgram implements Runnable, Closeable {
                        }
 
                } catch (Throwable t) {
-                       t.printStackTrace();
+                       LOGGER.error("FATAL: MainProgram died unexpectedly", t);
                } finally {
                        deathBarrier.release();
                }
@@ -356,7 +357,7 @@ public class MainProgram implements Runnable, Closeable {
                 executor.awaitTermination(500, TimeUnit.MILLISECONDS);
                 clusterUpdateThreads[i] = null;
             } catch (InterruptedException e) {
-                e.printStackTrace();
+                LOGGER.error("clusterUpdateThread[{}] termination interrupted", i, e);
             }
         }
     }