mirror of
https://gitee.com/BDWare/front-base
synced 2025-01-10 01:44:01 +00:00
style: prune logs
change logs of System.out.println to LOGGER.debug
This commit is contained in:
parent
ab341b58b6
commit
be91e3c5b9
@ -3,15 +3,12 @@ package org.bdware.server.action;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.Console;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@ -74,46 +71,49 @@ public class ActionExecutor<T, U> {
|
|||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendHandler(Object obj) {
|
public void appendHandler(Object obj) {
|
||||||
try {
|
try {
|
||||||
if (obj == null) return;
|
if (null == obj) {
|
||||||
Method[] methods = obj.getClass().getDeclaredMethods();
|
return;
|
||||||
System.out.println("zzz2"+obj.getClass());
|
}
|
||||||
for (Method method : methods) {
|
Method[] methods = obj.getClass().getDeclaredMethods();
|
||||||
if (method.getAnnotation(Action.class) != null) {
|
LOGGER.debug("zzz2" + obj.getClass());
|
||||||
if (method.getAnnotation(Action.class).alias().length == 0) {
|
for (Method method : methods) {
|
||||||
handlers.put(method.getName(), new Pair<>(method, obj));
|
if (null != method.getAnnotation(Action.class)) {
|
||||||
if (!method.getReturnType().equals(Void.TYPE)
|
if (method.getAnnotation(Action.class).alias().length == 0) {
|
||||||
|| method.getParameterCount() != 2) {
|
handlers.put(method.getName(), new Pair<>(method, obj));
|
||||||
LOGGER.error(
|
if (!method.getReturnType().equals(Void.TYPE)
|
||||||
"action ret is not void:"
|
|| method.getParameterCount() != 2) {
|
||||||
+ obj.getClass().getCanonicalName()
|
LOGGER.error(
|
||||||
+ "-->"
|
"action ret is not void:"
|
||||||
+ method.getName());
|
+ obj.getClass().getCanonicalName()
|
||||||
|
+ "-->"
|
||||||
|
+ method.getName());
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (String a : method.getAnnotation(Action.class).alias()) {
|
for (String a : method.getAnnotation(Action.class).alias()) {
|
||||||
handlers.put(a, new Pair<>(method, obj));
|
handlers.put(a, new Pair<>(method, obj));
|
||||||
if (!method.getReturnType().equals(Void.TYPE)
|
if (!method.getReturnType().equals(Void.TYPE)
|
||||||
|| method.getParameterCount() != 2) {
|
|| method.getParameterCount() != 2) {
|
||||||
LOGGER.error(
|
LOGGER.error(
|
||||||
"action ret is not void:"
|
"action ret is not void:"
|
||||||
+ obj.getClass().getCanonicalName()
|
+ obj.getClass().getCanonicalName()
|
||||||
+ "-->"
|
+ "-->"
|
||||||
+ method.getName());
|
+ method.getName());
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(String action, final U args, final T callback)
|
public void handle(String action, final U args, final T callback)
|
||||||
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||||
// logger.info("[ActionExecutor] handle : "+action);
|
// logger.info("[ActionExecutor] handle : "+action);
|
||||||
|
Loading…
Reference in New Issue
Block a user