Created
February 3, 2020 09:06
-
-
Save zhuyifan2013/3ae8bedd7867a3d59b48654e12959df5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.sf.cglib.proxy.Enhancer; | |
import net.sf.cglib.proxy.MethodInterceptor; | |
import net.sf.cglib.proxy.MethodProxy; | |
import java.lang.reflect.Method; | |
/** | |
* VM options: -XX:MaxMetaspaceSize=10m | |
*/ | |
public class MethodAreaError { | |
public static void main(String[] args) throws Throwable { | |
while (true) { | |
Enhancer enhancer = new Enhancer(); | |
enhancer.setSuperclass(MyObject.class); | |
enhancer.setUseCache(false); | |
enhancer.setCallback(new MethodInterceptor() { | |
@Override | |
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { | |
return methodProxy.invokeSuper(o,args); | |
} | |
}); | |
enhancer.create(); | |
} | |
} | |
static class MyObject { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment