synchronization - Avoiding multiple lock attempts java -


i have following method:

public foo bar(string id) {     lock locallock = lockutil.lock(id);     try {         something;         return foo;     } {         lock.unlock();     } } 

i need override method take in parameter.

public foo bar(string id, integer index) {     lock locallock = lockutil.lock(id);     try {         index;     } {         lock.unlock();     }      return bar(id); } 

my question is, how can achieve without obtaining locks twice (in case second method called)? don't want change signature of original method, since mean making changes @ 10 different places in system. i'd appreciate ideas. can give more clarification regarding question, if required. thanks.


Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -