Hi,

I haven't tried, but can I do:

```
void foo(lots of params) {
  Object lock = (a particular condition) ? realLock : null;

  synchronized(lock) {
    // lots of complex code block here
  }

}
```

i.e depending on a a particular condition, the complex code block either need to be sync-protected, or not needed.

Method foo has lots of params, I try to avoid refactor the inner code block into a separate method.

So my question: is it possible synchronized(null)? essentially means NO-OP.

If it's not currently supported, can we add such feature?

Thank.

Reply via email to