How to use BASE64Encoder().encode(bytes) in parallel threads

Viewed 83

I am using the sun.misc.CharacterEncoder.encode(bytes) method to encode strings in 10 parallel threads.

I observed that this encode method is trying to access the System.getProperty() which in turn is accessing the Hashtable.get() method that is synchronized. Due to this, the other 9 threads are going into a blocked state and only one thread is in an active state which is affecting the performance.

Can we do anything here to not to block the other threads? Or any suggestions to use other methods for encoding?

0 Answers
Related