From 55d6463589bf605e27e8ac8148240b8dec13106f Mon Sep 17 00:00:00 2001 From: Kazuki Tsutsumi Date: Thu, 6 Apr 2017 14:40:02 +0900 Subject: [PATCH] Change to ignore Throwables when it scan clazzes in batch jar file. --- .../control_bus/component/apps.clj | 2 +- .../control_bus/BatchComponentScanner.java | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/clj/job_streamer/control_bus/component/apps.clj b/src/clj/job_streamer/control_bus/component/apps.clj index 8765269..02d7912 100644 --- a/src/clj/job_streamer/control_bus/component/apps.clj +++ b/src/clj/job_streamer/control_bus/component/apps.clj @@ -54,7 +54,7 @@ (letfn [(print-err [] (with-open [rdr (io/reader (.getErrorStream proc))] (->> (line-seq rdr) - (map #(log/error %)) + (map #(log/debug %)) doall)))] (.start (Thread. print-err))) (with-open [rdr (io/reader (.getInputStream proc))] diff --git a/src/java/net/unit8/job_streamer/control_bus/BatchComponentScanner.java b/src/java/net/unit8/job_streamer/control_bus/BatchComponentScanner.java index 28f15e1..a3b9b27 100644 --- a/src/java/net/unit8/job_streamer/control_bus/BatchComponentScanner.java +++ b/src/java/net/unit8/job_streamer/control_bus/BatchComponentScanner.java @@ -89,36 +89,35 @@ void pickOverBatchComponent(String resourcePath, ClassLoader cl) { || className.startsWith("com.sun.") || className.startsWith("sun.") || className.startsWith("clojure.")) { - System.err.println("This is ignored with wrong package name"); + System.err.println("This is ignored according to package name."); return; } try { Class clazz = cl.loadClass(className); if (Batchlet.class.isAssignableFrom(clazz)) { - System.err.println(" This clazz is Batchlet"); + System.err.println(" This clazz is Batchlet."); container.batchlets.add(decideRefName(clazz)); } else if (ItemReader.class.isAssignableFrom(clazz)) { - System.err.println(" This clazz is ItemReader"); + System.err.println(" This clazz is ItemReader."); container.itemReaders.add(decideRefName(clazz)); } else if (ItemWriter.class.isAssignableFrom(clazz)) { - System.err.println(" This clazz is ItemWriter"); + System.err.println(" This clazz is ItemWriter."); container.itemWriters.add(decideRefName(clazz)); } else if (ItemProcessor.class.isAssignableFrom(clazz)) { - System.err.println(" This clazz is ItemProcessor"); + System.err.println(" This clazz is ItemProcessor."); container.itemProcessors.add(decideRefName(clazz)); } else if (isListener(clazz)) { - System.err.println(" This clazz is Listener"); + System.err.println(" This clazz is Listener."); container.listeners.add(decideRefName(clazz)); } else if (Throwable.class.isAssignableFrom(clazz)) { - System.err.println(" This clazz is Throwable"); + System.err.println(" This clazz is Throwable."); container.throwables.add(decideRefName(clazz)); } else { - System.err.println(" This clazz is ignored"); + System.err.println(" This clazz is ignored."); } - } catch (ClassNotFoundException | NoClassDefFoundError e) { - System.err.println(" This clazz is ignored with Exception"); + } catch (Throwable e) { + System.err.println(" This clazz is ignored with Throwable."); e.printStackTrace(); - // ignore } } }