diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/MemoryUtil.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/MemoryUtil.java index 3b62bab9..ad2b0678 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/MemoryUtil.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/MemoryUtil.java @@ -26,7 +26,7 @@ import java.lang.management.MemoryUsage; /** * memory util
- * the obtained information is not invalid, after a long wait, obtain it again + * the obtained information is not real time effective, after a long wait, please get it again * * @author liuwenhao */ diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ReflectUtil.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ReflectUtil.java index 9a4bfa86..d278ec55 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ReflectUtil.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ReflectUtil.java @@ -250,4 +250,18 @@ public class ReflectUtil { throw new IllegalException(e); } } + + /** + * get instance + * + * @param cls the class + * @return new Instance + */ + public static Object createInstance(Class cls) { + try { + return cls.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new IllegalException(e); + } + } }