Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronization in the update-Method.  RSS feed

Olena Golub
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 tier architecture. Every client receives the own instance of the Data class through ConnectionFactory.
All locked records with locked cookies I saved in:

Inside the lock and unlock methods I synchronize lockedRecord.

But I am totaly lost about the update method. I will check the lockedRecords in this method, therefore I need also
to syncronize lockedRecords.
But what about RandomAccessFile raf?
Should I also synchronize it in the update method?
Or should I not synchronize the RandomAccessFile object at all to prevent from the dead-locks?
My write method is also not synchronized.

Could you help me?
Thanks a lot for your help!
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!