K
Karl Gorden
If I have two objects and I want to ensure nothing happens on both of them
while I do an operation, is it ok to synchronize twice, aka
synchronized (obj1) {
synchronized (obj2) {
// work here
}
}
or
sychronized public void method(Object obj) {
sychronized (obj) {
}
}
while I do an operation, is it ok to synchronize twice, aka
synchronized (obj1) {
synchronized (obj2) {
// work here
}
}
or
sychronized public void method(Object obj) {
sychronized (obj) {
}
}