Snapshot of new files

This commit is contained in:
2016-06-20 11:13:03 +01:00
parent 4d6f71d954
commit 3e9d66286c
7 changed files with 612 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package base.work;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import base.worker.Worker;
public class ReflectiveListen extends Listen<Object> {
public ReflectiveListen() {
super();
}
public ReflectiveListen(Worker.Type workerType) {
super(workerType);
}
public void input(Object object) {
Class<?> clazz = object.getClass();
MethodType methodType = MethodType.methodType(void.class, clazz);
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle methodHandle;
try {
methodHandle = lookup.findVirtual(getClass(), "input", methodType);
methodHandle.invoke(this, object);
} catch (Exception e) {
logger.error("", e);
} catch (Throwable e) {
logger.error("", e);
}
}
}