style: prune logs

change logs of System.out.println to LOGGER.debug
This commit is contained in:
Frank.R.Wu 2021-11-10 20:50:23 +08:00
parent ab341b58b6
commit be91e3c5b9

View File

@ -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<T, U> {
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);