[CASSANDRA-21020][trunk] Optimize thread local for metrics and tracing#4831
[CASSANDRA-21020][trunk] Optimize thread local for metrics and tracing#4831netudima wants to merge 1 commit into
Conversation
a7ec5e6 to
186e3c7
Compare
Implement custom CassandraThread to keep direct references to frequently used thread local objects patch by Dmitry Konstantinov; reviewed by TBD for CASSANDRA-21020
186e3c7 to
0da4a5e
Compare
| creationTrace = Arrays.copyOfRange(creationTrace, 2, creationTrace.length); | ||
| } | ||
|
|
||
| public InspectableFastThreadLocalThread() { super(); setStack(); } |
There was a problem hiding this comment.
not completely sure we can just remove it like this, something tells me that somebody is using it outside of Cassandra tree, or just ask Sam Tunnicliffe what all these unused constructors are for.
There was a problem hiding this comment.
I've checked with Sam, he doesn't think that should be a problem
| return current != null ? current : ExecutorLocals.none(); | ||
| } | ||
|
|
||
| public void doRun() |
There was a problem hiding this comment.
This is easy to get wrong, like just running doRun() with the work and not calling run() at all. It just feels strange to have empty doRun() like this.
doRun might be abstract and we would have a class like DefaultCassandraThread which would just have this doRun() explicitly empty. Just a suggestion really, maybe just java doc would do it.
Some documentation would not be bad to add either, it is a bit confusing what is called where. run calls super.run which actually runs Runnable target we pass to this constructor, then doRun() is supposed to do what exactly?
| } | ||
|
|
||
| public void run() | ||
| public void doRun() |
There was a problem hiding this comment.
why not to call super(...) version in CommitLogThread constructor where target would be a Runnable running this run() method? It might be anonymous Runnable passed to that constructor's super, basically. We would get rid of doRun(), no?
Implement custom CassandraThread to keep direct references to frequently used thread local objects
patch by Dmitry Konstantinov; reviewed by TBD for CASSANDRA-21020