transmittable-thread-local icon indicating copy to clipboard operation
transmittable-thread-local copied to clipboard

improve the type safety of transmitter

Open oldratlee opened this issue 4 years ago • 0 comments

capture() --captured--> replay() --backup--> restore()
                                   |
                        clear()  --/             

capture/replay/clear/restore method in Transmitter is not type-safe(use generic type Object).

https://github.com/alibaba/transmittable-thread-local/blob/2a7667a2f3e9c65e71bfa42074a579344f538ced/src/main/java/com/alibaba/ttl/TransmittableThreadLocal.java#L362-L370

improve the type safety of transmitter

  • the input of replay should be constricted to the output of capture.
  • the input of restore should be constricted to the output of replay/clear.

oldratlee avatar Mar 16 '20 02:03 oldratlee