Skip to content

-XX:[+|-]VMLockClassLoader

This option affects synchronization on class loaders that are not parallel-capable class loaders, during class loading.

Syntax

    -XX:[+|-]VMLockClassLoader
Setting Effect Default
-XX:+VMLockClassLoader Enable yes
-XX:-VMLockClassLoader Disable

The option, -XX:+VMLockClassLoader, causes the VM to force synchronization on a class loader that is not a parallel capable class loader during class loading. This action occurs even if the loadClass() method for that class loader is not synchronized. For information about parallel capable class loaders, see java.lang.ClassLoader.registerAsParallelCapable(). Note that this option might cause a deadlock if class loaders use non-hierarchical delegation. For example, setting the system property osgi.classloader.lock=classname with Equinox is known to cause a deadlock. This is the default option.

When specifying the -XX:-VMLockClassLoader option, the VM does not force synchronization on a class loader during class loading. The class loader still conforms to class library synchronization, such as a synchronized loadClass() method.