How can I use Byteman to intercept Thread.interrupt() calls?

Solution Verified - Updated -

Issue

I want to use byteman to intercept calls to Thread.interrupt() using a rule like the following:

RULE check who is calling Thread.interrupt()
CLASS java.lang.Thread  
METHOD interrupt()  
AT ENTRY  
IF TRUE  
DO traceStack("\*\*\* called interrupt on thread " + $0 + " from thread " + Thread.currentThread(), 50)  
ENDRULE

After setting up this rule and testing a Thread.interrupt() call, no logging is generated.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x
  • OpenJDK 8
  • OpenJDK 11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content