Java synchronized method with expensive parameters
java, synchronization
Solution
That can't be it; the `generateParameter()` call is executed first, and its results are then given as an argument to the `myMethod` call, which then grabs the mutex.
Is it taking long, or is it indefinitely blocked? (a deadlock)
Problem
I have a synchronized method that appears to be 'using' the synchronization for significantly longer than it should. It looks something like; ``` public static synchronized void myMethod(MyParameter p) { //body (not expensive) } ``` The call looks like; ``` myMethod(generateParameter()); ``` Where `generateParameter()` is known to be a very expensive (takes a long time) call. My thinking is that the mutex on the `myMethod` class is blocked during the execution of `generateParameter()` is this what happens? I'm finding it a different problem to debug but this is what appears to be going on.