From: Tuukka Lehtonen Date: Thu, 4 Oct 2018 05:21:50 +0000 (+0300) Subject: Fixed Acorn MainProgram and GraphClientImpl2 to use Logger X-Git-Tag: v1.43.0~136^2~345 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F2275%2F1;p=simantics%2Fplatform.git 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 --- 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); } } }