Skip to content

Instantly share code, notes, and snippets.

View simonis's full-sized avatar

Volker Simonis simonis

View GitHub Profile
@simonis
simonis / InternalMBeans.java
Last active November 7, 2024 17:03
The HotSpot internal `sun.management` MBeans
import java.lang.management.ManagementFactory;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.management.OperatingSystemMXBean;
public class InternalMBeans {
@simonis
simonis / ClassInit.java
Last active August 21, 2024 17:00
Concurrent class initialization
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
public class ClassInit {
static final int CLASSLOADERS = Integer.getInteger("classloaders", 3);
static final int THREADS = Integer.getInteger("threads", 3);
static class MyClassLoader extends URLClassLoader {
public MyClassLoader() {
@simonis
simonis / GetLineNumber.java
Last active June 30, 2023 14:31
Get the source code line number in Java programmatically at runtime
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Stream;
public class GetLineNumber {
@simonis
simonis / G1_HeapAfterGCUsage_1g.svg
Last active October 31, 2023 15:25
Comparing JMX and hsperf metrics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

To claim this, I am signing this object:

void foo() {}
struct A {
A() {
foo();
}
};
struct B {
B() {