In my application I have a method which is called by multiple threads simultaneously. Each thread calls this method many times while running.
private Locale trLoc = new Locale("tr", "TR");
public double calculate(String arg1){
arg1 = arg1.toUpperCase(trLoc);
...
}
This method makes a String.toUpperString(Locale)
call which causes a bottleneck because of the HashTable
usage within the Locale class. Each thread waits other one while toUpperCase
method operates. This situation slows down my application up to three times.
Is there something I'm missing with the usage of the Locale or I must use another class for the same purpose?
Thanks in advance.
After short exploring it looks like JDK can't help you. I suggest get java.lang.ConditionalSpecialCasing
class, copy it and fix problem with Hashtable. You may replace Hashtable
with HashMap
. I do not see any reason for using Hashtable
here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With