Igniters,

According to javadoc [1] class ThreadLocal:
`ThreadLocal instances are typically private *static* fields in classes
that wish to associate state with a thread (e.g., a user ID or Transaction
ID).`

So, AFAIK non-static ThreadLocal usage means as `per thread - per class
instance`. What the real cases of using non-static ThreadLocal class fields
in Ignite code project? When we need it?

In Ignite code project I've found ThreadLocal usage as:
 - non-static - 67
 - static  - 68

Back to my example, I've checked FileWriteAheadLogManager. It has:
1) private final ThreadLocal<Boolean> interrupted [2]
2) private final ThreadLocal<WALPointer> lastWALPtr [3]
I think both of these fields should be set and used as `static`. Can anyone
confirm it?


[1] https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html
[2]
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java#L253
[3]
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java#L340
-- 
--
Maxim Muzafarov

Reply via email to