centiservice / mats3

Mats3: Message-based Asynchronous Transactional Staged Stateless Services
https://mats3.io/
Other
63 stars 7 forks source link

Make TraceId implement CharSequence. #52

Closed staale closed 1 year ago

staale commented 2 years ago

This refactors the TraceId a bit, and in particular results in a TraceId instance to always have the same randomPart (before this was generated on each toString call).

All the fields in the TraceId are now initialized, so that we can implement the CharSequence interface. Rather than just relying on toString for this, each method is implemented as a function on top of the array of CharSequences within the TraceId.

Change-Id: I711fc685e86c462a0be1216530aa07c1745cfec1

stolsvik commented 1 year ago

I've implemented a similar solution now. Thanks for the idea!