临时日志

This commit is contained in:
redkale
2023-06-29 15:43:12 +08:00
parent 5f34ef68cc
commit 49823d457c

View File

@@ -302,10 +302,12 @@ public final class Utility {
private static String readLambdaFieldNameFromBytes(Serializable func) { private static String readLambdaFieldNameFromBytes(Serializable func) {
try { try {
Logger logger = Logger.getLogger(Utility.class.getSimpleName()); Logger logger = Logger.getLogger(Utility.class.getSimpleName());
ObjectWriteStream out = new ObjectWriteStream(); ByteArrayOutputStream bytes = new ByteArrayOutputStream();
logger.info("设置enableReplaceObject结果: + " + out.enableReplaceObject(true)); ObjectWriteStream out = new ObjectWriteStream(bytes);
logger.info("enableReplaceObject-setting: " + out.enableReplaceObject(true));
out.writeObject(func); out.writeObject(func);
out.close(); out.close();
logger.info("out-content: " + binToHexString(bytes.toByteArray()));
return readFieldName(out.methodNameReference.get()); return readFieldName(out.methodNameReference.get());
} catch (IOException e) { } catch (IOException e) {
throw new RedkaleException(e); throw new RedkaleException(e);
@@ -334,14 +336,14 @@ public final class Utility {
public final ObjectReference<String> methodNameReference = new ObjectReference<>(); public final ObjectReference<String> methodNameReference = new ObjectReference<>();
public ObjectWriteStream() throws IOException { public ObjectWriteStream(OutputStream out) throws IOException {
super(new ByteArrayOutputStream()); super(out);
} }
@Override @Override
protected Object replaceObject(Object obj) throws IOException { protected Object replaceObject(Object obj) throws IOException {
Logger logger = Logger.getLogger(Utility.class.getSimpleName()); Logger logger = Logger.getLogger(Utility.class.getSimpleName());
logger.info("obj: " + obj.getClass() + ", 内容: " + obj); logger.info("obj-class: " + obj.getClass() + ", content: " + obj);
if (obj instanceof java.lang.invoke.SerializedLambda) { if (obj instanceof java.lang.invoke.SerializedLambda) {
methodNameReference.set(((java.lang.invoke.SerializedLambda) obj).getImplMethodName()); methodNameReference.set(((java.lang.invoke.SerializedLambda) obj).getImplMethodName());
} }