How to avoid method execution from multiple threads if they pass same parameter. for example I have this method:
public void sync(int x){
//sync code -> write code here which is eligible for sync
}
If this method is running with parameter x=5
and another request with same value x=5
comes, it should be added in queue.