centiservice / mats3

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

Fix the special ThreadPool's LinkedTransferQueue of MatsFuturizer to handle Java 21.0.2's reimpl of put(E) method! #87

Closed stolsvik closed 8 months ago

stolsvik commented 8 months ago

Previously, LinkedTransferQueue's methods offer(E) and put(E) had separate implementations, but with the same code: xfer(e, true, ASYNC, 0L);

Thus, when we overrode offer(E) to invoke tryTranser(e), the put(E) method was unaffected. And the special implementation of MatsFuturizer's ThreadPoolExecutor's RejectedExecutionHandler used the put(E) method to enqueue the task "anyway".

However, with Java 21.0.2, the put(E) method was reimplemented to just call offer(E)! This was pretty bad news for the MatsFuturizer implementation: If more than maximumPoolSize tasks were enqueued, the latter ones would just be thrown out.

Fix this to make a new sneak(E) method that invokes super.offer(E) instead.