[Solved] Explain Transaction Class Method Nexttxnumber Synchronized 1 Could Happen 2 Problem Method Q37189725
Explain why the Transaction class method nextTxNumber issynchronized.
1) What could happen if it were not?
2) Is it a problem for the other methods in that class to not besynchronized?
Please explain your answer.
public int size(String filename) { Block dummyblknew Block(filename, END_OF_FILE); concurMgr.sLock (dummyblk); return SimpleDB.fileMgr).size(filename); Appends a new block to the end of the specified file and returns a reference to it. *This method first obtains an XLock on the “end of the file”, before performing the append Oparam filename the name of the file param fmtr the formatter used to initialize the new page * return a reference to the newly-created disk block public Block append(String filename, PageFormatter fmtr) Block dummyblknew Block(filename, END_OF_FILE); concurMgr.xLock (dummyblk); Block blk myBuffers.pinNew(filename, fmtr); unpin(blk); return blk; private static synchronized int nextTxNumber){ nextTxNum++; System.out.println(“new transaction:”nextTxNum); return next TxNum Show transcribed image text public int size(String filename) { Block dummyblknew Block(filename, END_OF_FILE); concurMgr.sLock (dummyblk); return SimpleDB.fileMgr).size(filename); Appends a new block to the end of the specified file and returns a reference to it. *This method first obtains an XLock on the “end of the file”, before performing the append Oparam filename the name of the file param fmtr the formatter used to initialize the new page * return a reference to the newly-created disk block public Block append(String filename, PageFormatter fmtr) Block dummyblknew Block(filename, END_OF_FILE); concurMgr.xLock (dummyblk); Block blk myBuffers.pinNew(filename, fmtr); unpin(blk); return blk; private static synchronized int nextTxNumber){ nextTxNum++; System.out.println(“new transaction:”nextTxNum); return next TxNum
Expert Answer
Answer to Explain why the Transaction class method nextTxNumber is synchronized. 1) What could happen if it were not? 2) Is it a p… . . .
OR

