Question about jvm-wide and multithreading properties


I need to use (at the moment) some java apis that -unfortunatelly- can be "configured" only via jvm properties.
I understand that this can affect multithreading, since it can be the case that one thread modifying the properties can affect the others running.
So I thought to do this inside a synchronized method e.g.

public static sychronized void someMethod(){
   //do code here

It seems it is ok, but I was wondering if there any pitfalls on this and whether there is any kind of design pattern for cases like these?


When you create a synchronized static method, it synchronizes on the class that the method is in. This means that only one method in that class will be able to run at a time. If that solves your problem, then perfect.

However, if any other method in the JVM modifies those properties outside of that class or outside of a method that's synchronized on the class, then your efforts won't have any effect.