From be91e3c5b98bcd0b1bd4add1bf7919c18ba08030 Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Wed, 10 Nov 2021 20:50:23 +0800 Subject: [PATCH] style: prune logs change logs of System.out.println to LOGGER.debug --- .../bdware/server/action/ActionExecutor.java | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/main/src/org/bdware/server/action/ActionExecutor.java b/src/main/src/org/bdware/server/action/ActionExecutor.java index 141653a..cb47519 100644 --- a/src/main/src/org/bdware/server/action/ActionExecutor.java +++ b/src/main/src/org/bdware/server/action/ActionExecutor.java @@ -3,15 +3,12 @@ package org.bdware.server.action; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.Console; import java.io.FileNotFoundException; import java.io.RandomAccessFile; -import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; @@ -74,46 +71,49 @@ public class ActionExecutor { return handlers; } - public void appendHandler(Object obj) { - try { - if (obj == null) return; - Method[] methods = obj.getClass().getDeclaredMethods(); - System.out.println("zzz2"+obj.getClass()); - for (Method method : methods) { - if (method.getAnnotation(Action.class) != null) { - if (method.getAnnotation(Action.class).alias().length == 0) { - handlers.put(method.getName(), new Pair<>(method, obj)); - if (!method.getReturnType().equals(Void.TYPE) - || method.getParameterCount() != 2) { - LOGGER.error( - "action ret is not void:" - + obj.getClass().getCanonicalName() - + "-->" - + method.getName()); + public void appendHandler(Object obj) { + try { + if (null == obj) { + return; + } + Method[] methods = obj.getClass().getDeclaredMethods(); + LOGGER.debug("zzz2" + obj.getClass()); + for (Method method : methods) { + if (null != method.getAnnotation(Action.class)) { + if (method.getAnnotation(Action.class).alias().length == 0) { + handlers.put(method.getName(), new Pair<>(method, obj)); + if (!method.getReturnType().equals(Void.TYPE) + || method.getParameterCount() != 2) { + LOGGER.error( + "action ret is not void:" + + obj.getClass().getCanonicalName() + + "-->" + + method.getName()); - System.exit(0); - } - } else { - for (String a : method.getAnnotation(Action.class).alias()) { - handlers.put(a, new Pair<>(method, obj)); - if (!method.getReturnType().equals(Void.TYPE) - || method.getParameterCount() != 2) { - LOGGER.error( - "action ret is not void:" - + obj.getClass().getCanonicalName() - + "-->" - + method.getName()); + System.exit(0); + } + } else { + for (String a : method.getAnnotation(Action.class).alias()) { + handlers.put(a, new Pair<>(method, obj)); + if (!method.getReturnType().equals(Void.TYPE) + || method.getParameterCount() != 2) { + LOGGER.error( + "action ret is not void:" + + obj.getClass().getCanonicalName() + + "-->" + + method.getName()); - System.exit(0); - } - } - } - } - } - }catch(Exception e){ - e.printStackTrace(); - } + System.exit(0); + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } } + public void handle(String action, final U args, final T callback) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { // logger.info("[ActionExecutor] handle : "+action);