The DataSplitter iterator inside BufferedTokenizer has some method with synchronized and some not.
If the class needs to be claimed thread safe, the state has to be atomically accessed by all exposed public methods not just a part.
|
public void append(String data) { |
Before applying the modification create a benchmark to demonstrate there isn't any performance loss on the single thread usage, because that's the main use case, but also do a multithreaded one, to verify how the performance metrics varies.
The DataSplitter iterator inside BufferedTokenizer has some method with
synchronizedand some not.If the class needs to be claimed thread safe, the state has to be atomically accessed by all exposed public methods not just a part.
logstash/logstash-core/src/main/java/org/logstash/common/BufferedTokenizer.java
Line 113 in 3c4d175
logstash/logstash-core/src/main/java/org/logstash/common/BufferedTokenizer.java
Line 142 in 3c4d175
Before applying the modification create a benchmark to demonstrate there isn't any performance loss on the single thread usage, because that's the main use case, but also do a multithreaded one, to verify how the performance metrics varies.