Please avoid ThreadLocal as much as possible

For the rest I think a Jira with a patch fits (means sounds OK with me at 1st 


Le 13/04/2018 à 11:14, Pradhan Yash Sharma a écrit :

While I was working on UtilCache.java file came across some improvements,
they are as follows:

1) Method and Variable access modifiers can be narrowed down to private
access modifier.

2) Then AtomicLong can be given value 0L instead of 0.

3) Some Variables is used in both synchronized and unsynchronized blocks,
so they can be declared final. eg,

*protected AtomicLong hitCount = new AtomicLong(0);                private
final AtomicLong hitCount = new AtomicLong(0L);*
One variable was able to get most of my attention is

*                protected ConcurrentMap<Object, CacheLine<V>> memoryTable
= null;*

This is used in synchronized and unsynchronized blocks, this Object can be
converted into ThreadLocal or AtomicReference but it would require changes
in the current implementation as well.

Lastly, there is extensive use of for loops for iteration we can use Java 8
Streams, Collector, and other functions to leverage implicit looping

Pradhan Yash Sharma

Reply via email to