Equivalent of C# lock in Java? -


equivalent of c# lock in java?

for example:

public int next() {   lock (this) {     return nextunsynchronized();   } } 

how port c# method java?

public int next() {     synchronized (this) {         return nextunsynchronized();     } } 

that's it. , next code better.

public synchronized int next() {     return nextunsynchronized(); } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -