You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java's type erasure removes generic type parameters at runtime (`List<User>` becomes `List`). This is problematic for deserialization—Jackson needs the full type to reconstruct objects correctly.
100
-
101
-
`TypeToken<T>` solves this by capturing generic types at compile time. Creating `new TypeToken<List<User>>() {}` produces an anonymous subclass whose superclass type parameter is preserved in bytecode and accessible via reflection (`getGenericSuperclass()`).
102
-
103
-
The `SerDes` interface provides both `Class<T>` and `TypeToken<T>` overloads:
104
-
- Use `Class<T>` for simple types: `String.class`, `User.class`
105
-
- Use `TypeToken<T>` for parameterized types: `new TypeToken<List<User>>() {}`
Java's type erasure removes generic type parameters at runtime (`List<User>` becomes `List`). This is problematic for deserialization—Jackson needs the full type to reconstruct objects correctly.
405
+
406
+
`TypeToken<T>` solves this by capturing generic types at compile time. Creating `new TypeToken<List<User>>() {}` produces an anonymous subclass whose superclass type parameter is preserved in bytecode and accessible via reflection (`getGenericSuperclass()`).
407
+
408
+
The `SerDes` interface provides both `Class<T>` and `TypeToken<T>` overloads:
409
+
- Use `Class<T>` for simple types: `String.class`, `User.class`
410
+
- Use `TypeToken<T>` for parameterized types: `new TypeToken<List<User>>() {}`
411
+
412
+
---
413
+
417
414
## Thread Coordination and Suspension Mechanism (Advanced)
418
415
419
416
The SDK uses a threaded execution model where the handler runs in a background thread, racing against a suspension future. This enables immediate suspension when operations need to pause execution (waits, retries), without waiting for the handler to complete naturally.
0 commit comments