Show Document Locking Threads

If there's a reproducible NetBeans hang due to document locking and it's unclear which thread holds a document's read/write lock then there's a patch jar which can be added to boot classpath of the NetBeans to output the culprit thread(s).

There are separate patch jars depending on which JDK version NetBeans IDE runs: AbstractDocumentPatch17_85.jar and AbstractDocumentPatch18_45.jar that can be downloaded here.
Note: The suffix numbers are JDK update numbers from where the AbstractDocument.java was taken and patched. Since there won't be any fixes inside AbstractDocument.java source in subsequent JDK updates very likely (and not in previous updates as well) the patch jar should likely work for all JDK updates of the particular JDK version.

To use the patch it's necessary to modify NetBeans IDE boot classpath e.g. by adding


to netbeans.conf.

If the patch works then NetBeans will output the following message into the log:

AbstractDocument-read/write logging v1.1 started

If a document is locked for more than 3000ms the patch will output the pending lock threads like this:

PENDING LOCKERS (numReaders=0, numWriters=1):
WRITE Thread: Thread[org.netbeans.api.progress.ProgressUtils for: org.netbeans.editor.ActionFactory$FormatAction$1,1,system], lockCount=1
	at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1414)
	at org.netbeans.editor.BaseDocument.extWriteLock(BaseDocument.java:1673)
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo