From 7057e920b41f05ea4a98d904abbc708d7f131fa2 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 4 Oct 2018 08:21:50 +0300 Subject: [PATCH] Fixed Acorn MainProgram and GraphClientImpl2 to use Logger Previously the t.printStackTrace() in MainProrgam.run caused an unexpected error that killed MainProgram to go down the drain. gitlab #141 Change-Id: If68244b0e0f029ca43bbc45159936d3d89e49262 --- .../src/org/simantics/acorn/GraphClientImpl2.java | 3 +-- .../src/org/simantics/acorn/MainProgram.java | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/GraphClientImpl2.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/GraphClientImpl2.java index 2ffdc715f..a0c2ef860 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/GraphClientImpl2.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/GraphClientImpl2.java @@ -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); } } } diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java index 8dea16d7f..ec4d56c21 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java @@ -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); } } } -- 2.43.2