Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a static synchronized method in parallel

I'm using a thrid-party lib that has a static synchronized method, i want to execute this method in parallel without modifiying its source.

What can i do ?

Should i create an executor service with a thread factory that sets a new context class loader ?

Thank you

like image 472
mfudi Avatar asked Apr 22 '26 03:04

mfudi


1 Answers

A static synchronized method means its locked on the class. only one thread can grab the lock on the class. You can not even subclass this class at it won't allow you to override the static method.

I am afraid, you can not do anything.

like image 75
Ravi Bhatt Avatar answered Apr 24 '26 19:04

Ravi Bhatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!