Novel but practical uses of Java
summary
OpenHFT examples show practical hacks: a class that extends Throwable for recorded stack traces to capture where resources are created or closed (useful for long‑lived file handles), deterministic cleanup of thread‑local caches via a thread wrapper using reflection, dynamic enums via Unsafe.allocateInstance for adding/altering enum-like IDs at runtime, 64‑bit time IDs unique per machine with micro/nano resolution, a lock‑free shared CharSequence cache, classValue metadata caching, safe‑point insertion and spin‑hint tricks, and a rethrow utility; currentTimeMicros measures ~30–50 ns and all work aims to remain Java 8 compatible.
AI-written summary · about
chapters (14)
- 0:00Introduction and welcome
- 1:11Extending Throwable for stack traces
- 8:22Dynamic enums for serialization
- 17:46Java 8 vs newer versions
- 21:59Using double over BigDecimal
- 26:33ThreadLocal resource cleanup
- 36:03Unique timestamp generation
- 41:03Thread-safe object pooling
- 43:19Documenting runtime exceptions
- 50:02ClassValue for metadata caching
- 52:13Vacuous exceptions handling
- 58:14Safe points in profiling
- 1:05:15Exception handling and testing
- 1:08:04Q&A on Java features
related talks
41mJava Made (Somewhat) Simple
01h 00mon Java - Historical Oddities & Persistent Itches
45mFive Java Features You Didnt Know About
43mRolling with New Java Enhancements: Practical Design Patterns
01h 05mTo #Java 24 and Beyond
19mAsk the Java Architects
48mSafely Shoot Yourself in the Foot with Java 9
04h 29mJava ON 2024 Day 3
