Part of the reasons why QuarkusClassLoader instances are kept around is the ThreadLocal in EventEmitter.
I'm not exactly sure why you are using a ThreadLocal here? The contract of the eventing services is not thread safe? I would expect them to be thread safe but I suppose there's a good reason.
In any case, I experimented with removing it and it seems to improve things quite significantly.
Now I'm not entirely sure why this was implemented in the first place so I open the PR more for discussion than to get merged right away...
Part of the reasons why
QuarkusClassLoader
instances are kept around is theThreadLocal
inEventEmitter
.I'm not exactly sure why you are using a
ThreadLocal
here? The contract of the eventing services is not thread safe? I would expect them to be thread safe but I suppose there's a good reason.In any case, I experimented with removing it and it seems to improve things quite significantly.
Now I'm not entirely sure why this was implemented in the first place so I open the PR more for discussion than to get merged right away...
/cc @phillip-kruger @cescoffier @jmartisk