Understanding Locking

The JVM uses two types of locks—thin locks that are helpful for brief periods and fat locks that are held when there's contention for resources. Threads sleep during a fat lock and spin during a think lock, thus making fat locks less resource intensive because spinning uses up CPU cycles. You can use the command -Xverbose:locks to view information about the JVM locks. You can enable locking instrumentation by using the following command:

-XX:UseLockProfiling=true

The preceding command shows details about the number and types of locks held by the JVM. You can enable the collection of locking information by the JRockit Runtime Analyzer using the following option at startup time:

-Djrockit.lockprofiling=true

Using Lock ...

Get Oracle WebLogic Server 11g Administration Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.