2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package TransactionalIO.core;
11 import TransactionalIO.exceptions.AbortedException;
12 import TransactionalIO.benchmarks.benchmark;
13 import TransactionalIO.benchmarks.customhandler;
14 import TransactionalIO.benchmarks.customhandler;
15 import TransactionalIO.interfaces.BlockAccessModesEnum;
16 import TransactionalIO.interfaces.ContentionManager;
17 import TransactionalIO.interfaces.TransactionStatu;
18 //import dstm2.file.managers.BaseManager;
19 import java.awt.event.ActionListener;
20 import java.beans.EventHandler;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.beans.PropertyChangeSupport;
24 import java.io.FileDescriptor;
25 import java.io.IOException;
26 import java.io.RandomAccessFile;
27 import java.util.Collections;
28 import java.util.HashMap;
29 import java.util.Iterator;
31 import java.util.TreeMap;
32 import java.util.Vector;
33 import java.util.concurrent.locks.Lock;
34 import java.util.concurrent.locks.ReentrantLock;
35 import java.util.concurrent.locks.ReentrantReadWriteLock;
36 import java.util.logging.Level;
37 import java.util.logging.Logger;
43 public class ExtendedTransaction implements TransactionStatu {
46 private native int nativepwrite(byte buff[], long offset, int size, FileDescriptor fd);
49 System.load("/home/navid/libkooni.so");
52 private boolean flag = true;
53 public TransactionStatu memorystate;
54 private PropertyChangeSupport changes = new PropertyChangeSupport(this);
58 public TreeMap msg = new TreeMap();
59 public int numberofwrites;
60 public int numberofreads;
62 public enum Status {ABORTED, ACTIVE, COMMITTED};
63 private boolean writesmerged = true;
65 //private Vector<ReentrantLock> heldoffsetlocks;
66 private Vector heldoffsetlocks;
68 //private Vector<ReentrantLock> heldblocklocks;
69 private Vector heldblocklocks;
71 //private HashMap<INode, Vector<TransactionalFile>> AccessedFiles;
72 private HashMap AccessedFiles;
75 //private HashMap<INode, HashMap<Integer, BlockAccessModesEnum> > accessedBlocks;
76 private HashMap accessedBlocks;
78 //private HashMap<TransactionalFile, TransactionLocalFileAttributes> LocaltoGlobalMappings;
79 private HashMap GlobaltoLocalMappings;
81 public HashMap merge_for_writes_done;
86 private HashMap writeBuffer;
88 private ContentionManager contentionmanager;
89 private /*volatile*/ Status status;
95 public ExtendedTransaction() {
97 // id = Integer.valueOf(Thread.currentThread().getName().substring(7));
98 heldblocklocks = new Vector() ;
99 heldoffsetlocks= new Vector();
100 AccessedFiles = new HashMap();
101 GlobaltoLocalMappings = new HashMap/*<TransactionalFile, TransactionLocalFileAttributes >*/();
102 writeBuffer = new HashMap();
103 status = Status.ACTIVE;
104 accessedBlocks = new HashMap();
105 merge_for_writes_done = new HashMap();
107 // setContentionmanager(new BaseManager());
108 // beginTransaction();
112 public ExtendedTransaction(TransactionStatu memorystate){
114 /* heldblocklocks = new Vector() ;
115 heldoffsetlocks= new Vector();
116 AccessedFiles = new HashMap();
117 GlobaltoLocalMappings = new HashMap();
118 writeBuffer = new HashMap();
119 status = Status.ACTIVE;
120 accessedBlocks = new HashMap();
121 merge_for_writes_done = new HashMap();
122 writesmerged = true;*/
123 this.memorystate = memorystate ;
126 private int invokeNativepwrite(byte buff[], long offset, int size, RandomAccessFile file) {
128 //System.out.println(buff.length);
129 // System.out.println(offset);
130 return nativepwrite(buff, offset, buff.length, file.getFD());
131 } catch (IOException ex) {
133 Logger.getLogger(TransactionalFile.class.getName()).log(Level.SEVERE, null, ex);
139 public void beginTransaction(){
140 this.addPropertyChangeListener(new customhandler(Status.ABORTED));
146 public void abort() {
148 // Status oldst = getStatus();
149 /* synchronized(benchmark.lock){
150 System.out.println("be ga raftim 0");
152 this.status = Status.ABORTED;
153 if (this.memorystate !=null && !(this.memorystate).isAborted()){
154 /* synchronized(benchmark.lock){
155 System.out.println(Thread.currentThread() +" be ga raftim 1 file");
157 this.memorystate.abortThisSystem();
158 /* synchronized(benchmark.lock){
159 System.out.println(Thread.currentThread() + " be ga raftim 2 file");
162 // Thread[] group = new Thread[30];
163 // Thread.currentThread().enumerate(group);
164 // group[this.id].interrupt();
165 /*synchronized(benchmark.lock){
166 System.out.println("/////////////");
167 System.out.println(Thread.currentThread() + " " +Thread.currentThread().enumerate(group));
168 System.out.println(Thread.currentThread() + " " +group[0]);
169 System.out.println(Thread.currentThread() + " " +group[1]);
170 System.out.println(Thread.currentThread() + " " +group[2]);
171 System.out.println("/////////////");
175 // this.changes.firePropertyChange("status", oldst, Status.ABORTED);
180 public Status getStatus() {
184 public boolean isActive() {
185 return this.getStatus() == Status.ACTIVE;
189 public boolean isAborted() {
190 return this.getStatus() == Status.ABORTED;
193 public ContentionManager getContentionmanager() {
194 return contentionmanager;
197 public void setContentionmanager(ContentionManager contentionmanager) {
198 this.contentionmanager = contentionmanager;
202 public HashMap getWriteBuffer() {
206 public HashMap getAccessedFiles() {
207 return AccessedFiles;
210 public boolean isWritesmerged() {
214 public void setWritesmerged(boolean writesmerged) {
215 this.writesmerged = writesmerged;
223 public HashMap getGlobaltoLocalMappings() {
224 return GlobaltoLocalMappings;
227 public HashMap getAccessedBlocks() {
228 return accessedBlocks;
232 public ContentionManager getBlockContentionManager(){
233 return ManagerRepository.getBlockcm();
236 public ContentionManager getOffsetContentionManager(){
237 return ManagerRepository.getOffsetcm();
240 public TreeMap getSortedFileAccessMap(HashMap hmap) {
241 /*TreeMap sortedMap = new TreeMap(hmap);
243 return new TreeMap(hmap);
247 public void setStatus(Status st){
248 Status oldst = getStatus();
250 this.changes.firePropertyChange("status", oldst, st);
256 public void addFile(TransactionalFile tf/*, TransactionLocalFileAttributes tmp*/) {
259 /* if (tf.appendmode) {
260 this.addtoFileAccessModeMap(tf.getInode(), FileAccessModesEum.APPEND);
261 } else if (tf.writemode) {
262 this.addtoFileAccessModeMap(tf.getInode(), FileAccessModesEum.READ_WRITE);
264 this.addtoFileAccessModeMap(tf.getInode(), FileAccessModesEum.READ);
266 // System.out.println("dsadssasadssa");
270 //tf.offsetlock.lock();
271 TransactionLocalFileAttributes tmp = new TransactionLocalFileAttributes(tf.getCommitedoffset().getOffsetnumber()/*, tf.getInodestate().commitedfilesize.get()*/);
272 //this.heldoffsetlocks.remove(tf.offsetlock);
273 tf.offsetlock.unlock();
277 if (AccessedFiles.containsKey(tf.getInode())){
278 dummy = (Vector) AccessedFiles.get(tf.getInode());
281 dummy = new Vector();
282 AccessedFiles.put(tf.getInode(), dummy);
287 // this.msg.put(System.nanoTime(), Thread.currentThread().getName() + " Unlocked the offset lock " + tf.offsetlock + " for file " + tf.getInode() + " form descriptor " + tf.getSequenceNum());
289 GlobaltoLocalMappings.put(tf, tmp);
290 merge_for_writes_done.put(tf.getInode(), Boolean.TRUE);
299 public boolean lockOffsets() { /// Locking offsets for File Descriptors
302 TreeMap hm = getSortedFileAccessMap(AccessedFiles);
303 Iterator iter = hm.keySet().iterator();
305 while (iter.hasNext() && (this.getStatus() == Status.ACTIVE)) {
306 INode key = (INode) iter.next();
308 Vector vec = (Vector) AccessedFiles.get(key);
309 Collections.sort(vec);
310 Iterator it = vec.iterator();
311 while (it.hasNext()){
312 TransactionalFile value = (TransactionalFile) it.next();
313 while (this.getStatus() ==Status.ACTIVE){
314 //if (value.offsetlock.tryLock()) {
315 value.offsetlock.lock();
317 // synchronized(value.getCommitedoffset()){
318 // value.getCommitedoffset().setOffsetOwner(this);
320 // this.msg.put(System.nanoTime(), Thread.currentThread().getName() + " Locked the offset lock in commit for file " + value.getInode() + " from descriptor "+ value.getSequenceNum() +"\n");
321 heldoffsetlocks.add(value.offsetlock);
324 // getContentionmanager().resolveConflict(this, value.getCommitedoffset());
328 if (this.getStatus() != Status.ACTIVE){
336 if (this.getStatus() != Status.ACTIVE){
344 /*public boolean commit() { /// Locking offsets for File Descriptors
346 Map hm = getSortedFileAccessMap(FilesAccesses);
348 Iterator iter = hm.keySet().iterator();
349 TransactionLocalFileAttributes value;
350 while (iter.hasNext() && (this.getStatus() == Status.ACTIVE)) {
351 INode key = (INode) iter.next();
352 value = (TransactionLocalFileAttributes) hm.get(key);
353 synchronized(value.getCurrentcommitedoffset()){
354 if (value.offsetlock.tryLock()) {
355 value.getCurrentcommitedoffset().setOffsetOwner(this);
356 heldblocklocks.add(value.offsetlock);
357 Iterator it = value.getCurrentcommitedoffset().getOffsetReaders().iterator(); // for in-place aborting visible readers strategy
360 ExtendedTransaction tr = (ExtendedTransaction) it.next();
366 getOffsetContentionManager().resolveConflict(this, value.getCurrentcommitedoffset().getOffsetOwner());
371 /*public boolean commit() { /// Locking offsets for File Descriptors with checking strategy
373 Map hm = getSortedFileAccessMap(FilesAccesses);
375 Iterator iter = hm.keySet().iterator();
376 TransactionLocalFileAttributes value;
377 while (iter.hasNext() && (this.getStatus() == Status.ACTIVE)) {
378 INode key = (INode) iter.next();
379 value = (TransactionLocalFileAttributes) hm.get(key);
381 if (value.isValidatelocaloffset()) {
382 if (value.getCopylocaloffset() == value.currentcommitedoffset.getOffsetnumber()) {
383 value.offsetlock.lock();
384 heldoffsetlocks.add(value.offsetlock);
385 if (!(value.getCopylocaloffset() == value.currentcommitedoffset.getOffsetnumber())) {
394 value.offsetlock.lock();
395 heldoffsetlocks.add(value.offsetlock);
403 public boolean lockBlock(BlockDataStructure block, BlockAccessModesEnum mode/*, GlobalINodeState adapter, BlockAccessModesEnum mode, int expvalue, INode inode, TransactionLocalFileAttributes tf*/) {
406 //boolean locked = false;
411 if (mode == BlockAccessModesEnum.READ){
412 lock = block.getLock().readLock();
418 lock = block.getLock().writeLock();
422 while (this.getStatus() == Status.ACTIVE) {
423 //synchronized(block){
425 // if (lock.tryLock()) {
427 // synchronized(benchmark.lock){
428 // System.out.println(Thread.currentThread() + " Lock the block lock for " + lock +" number " + block.getBlocknumber());
430 heldblocklocks.add(lock);
431 // block.setOwner(this);
436 //getContentionmanager().resolveConflict(this, block);
442 public boolean lockBlock(BlockDataStructure block, Adapter adapter, BlockAccessModesEnum mode, int expvalue) { // from here for visible readers strategy
443 while (this.getStatus() == Status.ACTIVE) {
444 if (lock.tryLock()) {
445 Thread.onAbortOnce(new Runnable() {
452 heldblocklocks.add(lock);
454 synchronized (adapter) {
455 block.setOwner(this);
456 // Iterator it = block.getReaders().iterator();
457 // while (it.hasNext())
459 // ExtendedTransaction tr = (ExtendedTransaction) it.next();
466 getBlockContentionManager().resolveConflict(this, block.getOwner());
473 public boolean lockBlock(BlockDataStructure block, Adapter adapter, BlockAccessModesEnum mode, int expvalue) { // versioning strat
474 while (this.getStatus() == Status.ACTIVE) {
475 if (lock.tryLock()) {
476 Thread.onAbortOnce(new Runnable() {
483 heldblocklocks.add(lock);
484 if (mode != BlockAccessModesEnum.WRITE) { egy
485 if (block.getVersion().get() != expvalue) {
490 synchronized (adapter) {
491 block.setOwner(this);
496 getContentionManager().resolveConflict(this, block.getOwner());
502 public void prepareCommit() {
503 if (this.status != Status.ACTIVE)
504 throw new AbortedException();
510 // this.msg.put(System.nanoTime(),Thread.currentThread().getName() + " Aborted \n");
511 /* synchronized(benchmark.lock){
512 benchmark.msg += Thread.currentThread().getName() + " Aborted in prepare commit\n";
514 //Thread.currentThread().stop();
515 throw new AbortedException();
519 ///////////////////////////
522 Map hm = getWriteBuffer();
524 Iterator iter = hm.keySet().iterator();
525 WriteOperations value;
526 Vector vec = new Vector();
527 while (iter.hasNext() && (this.getStatus() == Status.ACTIVE) && ok) {
530 INode key = (INode) iter.next();
531 vec = (Vector) hm.get(key);
532 Collections.sort(vec);
533 Iterator it = vec.iterator();
534 while (it.hasNext()){
536 value = (WriteOperations) it.next();
537 if (value.isUnknownoffset()){
542 //synchronized(value.getOwnertransactionalFile().getCommitedoffset()){
543 start = value.getRange().getStart() - value.getBelongingto().getCopylocaloffset() + value.getOwnertransactionalFile().getCommitedoffset().getOffsetnumber();
544 end = value.getRange().getEnd() - value.getBelongingto().getCopylocaloffset() + value.getOwnertransactionalFile().getCommitedoffset().getOffsetnumber();
545 if (value.getBelongingto().isUnknown_inital_offset_for_write()){
546 value.getBelongingto().setLocaloffset(value.getBelongingto().getLocaloffset() - value.getBelongingto().getCopylocaloffset() + value.getOwnertransactionalFile().getCommitedoffset().getOffsetnumber());
547 value.getBelongingto().setUnknown_inital_offset_for_write(false);
551 // System.out.println("start write " + start);
552 /// System.out.println("end write " + end);
553 int startblock = FileBlockManager.getCurrentFragmentIndexofTheFile(start);
554 int targetblock = FileBlockManager.getTargetFragmentIndexofTheFile(start, value.getRange().getEnd() - value.getRange().getStart());
557 if (this.getAccessedBlocks().get(key) != null){
558 sset = (TreeMap) this.getAccessedBlocks().get(key);
562 sset = new TreeMap();
563 this.getAccessedBlocks().put(key, sset);
567 for (int i = startblock; i <= targetblock; i++) {
568 if (sset.containsKey(Integer.valueOf(i))){
569 if (sset.get(Integer.valueOf(i)) != BlockAccessModesEnum.WRITE)
570 sset.put(Integer.valueOf(i), BlockAccessModesEnum.READ_WRITE);
573 sset.put(Integer.valueOf(i), BlockAccessModesEnum.WRITE);
575 // tt.add(Integer.valueOf(i));
578 value.getRange().setStart(start);
579 value.getRange().setEnd(end);
581 // System.out.println(Thread.currentThread().);
582 // System.out.println(value.getRange().getStart());
583 // System.out.println(value.getRange().getEnd());
584 // System.out.println("---------------");
585 //this.getAccessedBlocks().put(value.getOwnertransactionalFile().getInode(), sset);
591 Iterator it = this.getAccessedBlocks().keySet().iterator();
592 while (it.hasNext() && (this.getStatus() == Status.ACTIVE)) {
593 INode inode = (INode) it.next();
594 GlobalINodeState inodestate = TransactionalFileWrapperFactory.getTateransactionalFileINodeState(inode);
595 TreeMap vec2 = (TreeMap) this.getAccessedBlocks().get(inode);
596 Iterator iter2 = vec2.keySet().iterator();
597 while(iter2.hasNext()){
598 Integer num = (Integer) iter2.next();
600 //BlockDataStructure blockobj = (BlockDataStructure) inodestate.lockmap.get(num);
601 BlockDataStructure blockobj;
602 // if (((BlockAccessModesEnum)vec2.get(num)) == BlockAccessModesEnum.WRITE){
603 blockobj = inodestate.getBlockDataStructure(num);
606 // blockobj = (BlockDataStructure) inodestate.lockmap.get(num);
608 ok = this.lockBlock(blockobj, (BlockAccessModesEnum)vec2.get(num));
611 /* synchronized(benchmark.lock){
612 benchmark.msg += Thread.currentThread().getName() + " Locked the Block Number " + blockobj.getBlocknumber() +" for " + inode + "\n";
614 // this.msg.put(System.nanoTime(), Thread.currentThread().getName() + " Locked the Block Number " + blockobj.getBlocknumber() + " for file " + inode + "\n");
618 if (this.getStatus() != Status.ACTIVE){
620 // this.msg.put(System.nanoTime(), Thread.currentThread().getName() + " Aborted \n");
621 /* synchronized(benchmark.lock){
622 benchmark.msg += Thread.currentThread().getName() + " Aborted \n";
624 // Thread.currentThread().stop();
625 throw new AbortedException();
630 //expvalue = ((Integer) value.getBlockversions().get(it)).intValue(); //for versioning strategy
631 /*if (!(value.isValidatelocaloffset())) {
632 if (((BlockAccessModesEnum) (value.getAccesedblocks().get(blockno))) != BlockAccessModesEnum.WRITE) { //versioning strategy
634 /if (blockobj.getVersion().get() == expvalue) {
636 ok = this.lock(blockobj, value.adapter, (BlockAccessModesEnum) (value.getAccesedblocks().get(blockno)), expvalue);
647 ok = this.lock(blockobj, value.adapter, (BlockAccessModesEnum) (value.getAccesedblocks().get(blockno)), expvalue);
657 throw new AbortedException();
661 public void commitChanges(){
663 // this.msg.put(System.nanoTime(), Thread.currentThread().getName() + " is committing \n");
667 //synchronized(benchmark.lock){
668 // System.out.println(Thread.currentThread().getName() + " is commiting");
672 Map hm = getWriteBuffer();
673 Iterator iter = hm.keySet().iterator();
675 WriteOperations writeop;
677 while (iter.hasNext() && (this.getStatus() == Status.ACTIVE)) {
678 INode key = (INode) iter.next();
680 vec = (Vector) hm.get(key);
681 Collections.sort(vec);
683 while (it.hasNext()){
686 //value = (WriteOperations) it.next();
687 // writeop = (WriteOperations) writeBuffer.get(key);
688 writeop = (WriteOperations) it.next();
689 // System.out.println(writeop);
690 Byte[] data = new Byte[(int) (writeop.getRange().getEnd() - writeop.getRange().getStart())];
691 byte[] bytedata = new byte[(int) (writeop.getRange().getEnd() - writeop.getRange().getStart())];
692 data = (Byte[]) writeop.getData();
694 for (int i = 0; i < data.length; i++) {
695 bytedata[i] = data[i];
700 // writeop.getOwnertransactionalFile().file.seek(writeop.getRange().getStart());
701 // System.out.println(Thread.currentThread() + " range " + writeop.getRange().getStart());
702 // writeop.getOwnertransactionalFile().file.write(bytedata);
703 invokeNativepwrite(bytedata, writeop.getRange().getStart(), bytedata.length, writeop.getOwnertransactionalFile().file);
704 // System.out.println(Thread.currentThread() + " " + bytedata);
706 // } catch (IOException ex) {
707 // Logger.getLogger(ExtendedTransaction.class.getName()).log(Level.SEVERE, null, ex);
714 /*if (((FileAccessModesEum) (this.FilesAccessModes.get(key))) == FileAccessModesEum.APPEND) {
716 Range range = (Range) value.getWrittendata().firstKey();
719 //synchronized(value.adapter){
720 //value.f.seek(value.adapter.commitedfilesize.get());
721 value.f.seek(value.getFilelength());
724 Byte[] data = new Byte[(int) (range.getEnd() - range.getStart())];
725 byte[] bytedata = new byte[(int) (range.getEnd() - range.getStart())];
726 data = (Byte[]) value.getWrittendata().get(range);
728 for (int i = 0; i < data.length; i++) {
729 bytedata[i] = data[i];
731 value.f.write(bytedata);
733 } catch (IOException ex) {
734 Logger.getLogger(ExtendedTransaction.class.getName()).log(Level.SEVERE, null, ex);
737 } else if (((FileAccessModesEum) (this.FilesAccessModes.get(key))) == FileAccessModesEum.READ) {
740 else if (value.relocatablewrite && value.getContinious_written_data() != null){
744 else if (!(value.getNon_Speculative_Writtendata().isEmpty())) {
745 int tobeaddedoffset = 0;
747 if (value.isValidatelocaloffset()) {
750 tobeaddedoffset = (int) (value.getCurrentcommitedoffset().getOffsetnumber() - value.getCopylocaloffset());
752 Iterator it = value.getNon_Speculative_Writtendata().keySet().iterator();
754 while (it.hasNext() && (this.getStatus() == Status.ACTIVE)) {
756 Range range = (Range) it.next();
759 value.f.seek(range.getStart() + tobeaddedoffset);
761 Byte[] data = new Byte[(int) (range.getEnd() - range.getStart())];
762 byte[] bytedata = new byte[(int) (range.getEnd() - range.getStart())];
763 data = (Byte[]) value.getNon_Speculative_Writtendata().get(range);
765 for (int i = 0; i < data.length; i++) {
766 bytedata[i] = data[i];
768 value.f.write(bytedata);
771 } catch (IOException ex) {
772 Logger.getLogger(ExtendedTransaction.class.getName()).log(Level.SEVERE, null, ex);
781 iter = hm.keySet().iterator();
782 while (iter.hasNext() ) {
783 INode key = (INode) iter.next();
784 value = (TransactionLocalFileAttributes) hm.get(key);
785 Iterator it = value.getAccesedblocks().keySet().iterator();
787 while (it.hasNext()) {
788 Integer blockno = (Integer) it.next();
789 synchronized (value.adapter) {
790 //BlockDataStructure blockobj = (BlockDataStructure) value.adapter.lockmap.get(blockno);
791 //blockobj.getVersion().getAndIncrement(); for versioning strategy
792 //value.getCurrentcommitedoffset().setOffsetnumber(value.getLocaloffset());
793 //value.adapter.commitedfilesize.getAndSet(value.getFilelength());
797 Iterator k = GlobaltoLocalMappings.keySet().iterator();
799 TransactionalFile trf = (TransactionalFile) (k.next());
800 // synchronized(trf.getCommitedoffset()){
801 trf.getCommitedoffset().setOffsetnumber(((TransactionLocalFileAttributes)GlobaltoLocalMappings.get(trf)).getLocaloffset());
802 /*synchronized(benchmark.lock){
803 System.out.println(Thread.currentThread() + " KIRIR " +GlobaltoLocalMappings.get(trf).getLocaloffset());
811 public void unlockAllLocks() {
812 Iterator it = heldblocklocks.iterator();
814 while (it.hasNext()) {
816 Lock lock = (Lock) it.next();
819 /*synchronized(benchmark.lock){
820 System.out.println(Thread.currentThread().getName() + " Released the block lock for " + lock);
823 heldblocklocks.clear();
825 it = heldoffsetlocks.iterator();
826 while (it.hasNext()) {
827 ReentrantLock lock = (ReentrantLock) it.next();
829 // synchronized(benchmark.lock){
830 // System.out.println(Thread.currentThread().getName() + " Released the offset lock for "+ lock +"\n");
833 heldoffsetlocks.clear();
836 public void abortAllReaders(){
837 TreeMap hm = getSortedFileAccessMap(AccessedFiles);
839 Iterator iter = hm.keySet().iterator();
840 TransactionalFile value;
841 while (iter.hasNext()) {
842 INode key = (INode) iter.next();
843 Vector vec = (Vector) AccessedFiles.get(key);
844 Iterator it = vec.iterator();
848 value = (TransactionalFile)it.next();
850 //value = (TransactionalFile) hm.get(key);
851 //System.out.println(value.getCommitedoffset().getOffsetReaders());
853 Iterator it2 = value.getCommitedoffset().getOffsetReaders().iterator(); // for visible readers strategy
854 while ( it2.hasNext())
857 ExtendedTransaction tr = (ExtendedTransaction) it2.next();
861 value.getCommitedoffset().getOffsetReaders().clear();
868 if (accessedBlocks.get(key) != null){
869 vec2 = (TreeMap) accessedBlocks.get(key);
872 vec2 = new TreeMap();
875 GlobalINodeState inodestate = TransactionalFileWrapperFactory.getTateransactionalFileINodeState(key);
876 Iterator it2 = vec2.keySet().iterator();
878 while (it2.hasNext())
881 Integer num = (Integer)it2.next();
882 if (vec2.get(num) != BlockAccessModesEnum.READ)
884 BlockDataStructure blockobj = (BlockDataStructure) inodestate.getBlockDataStructure(num);//lockmap.get(num);
885 Iterator it4 = blockobj.getReaders().iterator(); // from here for visible readers strategy
887 while (it4.hasNext())
890 ExtendedTransaction tr = (ExtendedTransaction) it4.next();
894 blockobj.getReaders().clear();
902 /* SortedSet sst = (SortedSet) this.getAccessedBlocks().get(key);
903 Iterator it3 = sst.iterator();
904 while (it3.hasNext()){
905 Integer num = (Integer)it.next();
906 BlockDataStructure blockobj = (BlockDataStructure) value.getInodestate().lockmap.get(num);
907 Iterator it4 = blockobj.getReaders().iterator(); // from here for visible readers strategy
908 while (it4.hasNext())
910 ExtendedTransaction tr = (ExtendedTransaction) it3.next();
919 public void addPropertyChangeListener(PropertyChangeListener listener){
920 this.changes.addPropertyChangeListener("status",listener);
923 public void removePropertyChangeListener(PropertyChangeListener listener){
924 this.changes.removePropertyChangeListener("status",listener);
927 public TransactionStatu getOtherSystem() {
931 public void setOtherSystem(TransactionStatu othersystem) {
932 memorystate = othersystem;
935 public Vector getHeldblocklocks() {
936 return heldblocklocks;
939 public void setHeldblocklocks(Vector heldblocklocks) {
940 this.heldblocklocks = heldblocklocks;
943 public Vector getHeldoffsetlocks() {
944 return heldoffsetlocks;
947 public void setHeldoffsetlocks(Vector heldoffsetlocks) {
948 this.heldoffsetlocks = heldoffsetlocks;
951 public void abortThisSystem() {
955 public boolean isCommitted() {
956 if (this.status == Status.COMMITTED)