Skip to content

Instantly share code, notes, and snippets.

@jfager
Created August 4, 2010 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfager/508556 to your computer and use it in GitHub Desktop.
Save jfager/508556 to your computer and use it in GitHub Desktop.
package org.jdiscript
import org.jdiscript.handlers.*
import org.jdiscript.util.VMSocketAttacher
import com.sun.jdi.*
VirtualMachine vm = new VMSocketAttacher(12345).attach()
JDIScript j = new JDIScript(vm)
j.monitorContendedEnterRequest({
long timestamp = System.currentTimeMillis()
println "${timestamp}: Contended enter for ${it.monitor()} by ${it.thread()}"
it.thread().frames().each { println " " + it }
} as OnMonitorContendedEnter).enable()
j.monitorContendedEnteredRequest({
long timestamp = System.currentTimeMillis()
println "${timestamp}: Contended entered for ${it.monitor()} by ${it.thread()}"
} as OnMonitorContendedEntered).enable()
j.run({ println "Got StartEvent" } as OnVMStart)
println "Shutting down"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment