You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
arthas/tutorials/katacoda/command-mc-retransform-en/retransform-more.md

2.1 KiB

Load the external *.class files to retransform the loaded classes in JVM.

Reference: Instrumentation#retransformClasses

View retransform entry

retransform -l{{execute T2}}

$ retransform -l
Id              ClassName       TransformCount  LoaderHash      LoaderClassName
1               com.example.dem 1               null            null
                o.arthas.user.U
                serController
  • TransformCount counts the times of attempts to return the .class file corresponding to the entry in the ClassFileTransformer#transform method, but it does not mean that the transform must be successful.

Delete the specified retransform entry

retransform -d 1{{execute T2}}

Need to specify id:

retransform -d 1

Delete all retransform entries

retransform --deleteAll{{execute T2}}

retransform --deleteAll

Explicitly trigger retransform

retransform --classPattern com.example.demo.arthas.user.UserController{{execute T2}}

$ retransform --classPattern com.example.demo.arthas.user.UserController
retransform success, size: 1, classes:
com.example.demo.arthas.user.UserController

Note: For the same class, when there are multiple retransform entries, if retransform is explicitly triggered, the entry added last will take effect (the one with the largest id).

Eliminate the influence of retransform

If you want to eliminate the impact after performing retransform on a class, you need to:

  • Delete the retransform entry corresponding to this class
  • Re-trigger retransform

If you do not clear all retransform entries and trigger retransform again, the retransformed classes will still take effect when arthas stop.

After deleting the retransform entry above and explicitly triggering the retransform, you can use the jad command to confirm that the result of the previous retransform has been eliminated.

Visit https://HOST_SUBDOMAIN-80-KATACODA_HOST.environments.katacoda.com/user/0 again, an exception will be thrown.