Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Locking without writeLock()  RSS feed

Animesh Saxena
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Andrew's book there's usage of writeLock().lock() for persist method. Here in my case I think its not required. dataSectionOffset is always same(It is set in the beginning only once when the server starts). dbInfo instance stores this kind of data, like dataSectionOffset and recordLength. synchronization of dbFile (RandomAccessFile) I guess is enough for this function. Let me know if I am wrong..!!???


long dataSectionOffset = dbInfo.getDataOffset();
StringBuffer padding = new StringBuffer();
StringBuffer content = new StringBuffer();

for(int fieldIndex = 0 ; fieldIndex < dbInfo.getNumberOfFields(); fieldIndex++){
int paddingLength = dbInfo.getFieldLength(fieldIndex) - data[fieldIndex].length();
long recordLength = dbInfo.getRecordLength();

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!