Link to home
Start Free TrialLog in
Avatar of matthew016
matthew016Flag for Belgium

asked on

Simple synchronized question

Hi,

let's say I have this :

class A {
     public synchronized void a() {
     }
     public synchronized void b() {
     }
}

will the requests queue up for each method, or for the class ?

I mean : if two requests want to access method b, one will access and other requests will be in a queue.
What happen if one request want to access a and another want to access b at the same time ?

Tthe synchronized keyword  bears upon the method or the whole class ?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of matthew016

ASKER

thanks, was not totally sure of this ;-)
:-)