• Post Reply Bookmark Topic Watch Topic
  • New Topic

issues with syncronized methods.

 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I completed my assignment. iam working on performance issues. I mave major doubt on synchronized methods.
i have a method
public bookSeats(....) {
lock()
reserve()
unlock()
}
i made the synchronized object lock on lock / unlock and reserve as syncronized method. i read so many articles. they say if a class implements another we should not syncronized the class method
like for example,
public syncronized bookseats() {
lock()
reserve()
unlock()
}
public void lock(){
syncronized(a) {
// lock row
}
}
public void unlock(){
syncronized(a) {
// unlock row
}
}
public syncronized reserve(){}
Iam confused with my readings. can someone explain me where exactly syncronized should be present ?
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!