~/talk

Writing Java agents for fun and not so much profit

Talkat Devoxx Belgium 2019 · 2019-11-04..11-08· [java]
links:none on file
slides:none on file

Shows how to build a working Java agent that rewrites bytecode at load time using java.lang.instrument and implements ClassFileTransformer, uses Javassist to insert Java snippets rather than raw opcodes, and demonstrates a real agent that injects connection/read timeouts into multiple HTTP client libraries (demo proves timeouts fail or succeed as expected). Covers static vs dynamic attach (attach API is com.sun and breaks for same-JVM attach on Java 9+), modular classloader pitfalls, and an integration test harness that launches a JVM with the agent and captures output alongside the JaCoCo agent for coverage.

AI-written summary · about

  1. 0:00Start
  2. 3:17Static agents
  3. 4:32Dynamic agents
  4. 6:25Class transformation
  5. 8:14Java bytecode
  6. 9:37Bytecode generation libraries
  7. 10:09Bytecode generation with Javassist
  8. 11:22Agent examples
  9. 13:32Mind the classloader
  10. 16:09OSGI - Weaving Hooks
  11. 17:08The challenges
  12. 18:34Bootstrapping the test
  13. 20:19OSGi integration testing
  14. 26:13When to use Java agents
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.