1 29 30 package com.caucho.db.store; 31 32 import com.caucho.log.Log; 33 import com.caucho.util.L10N; 34 35 import java.io.IOException ; 36 import java.util.logging.Level ; 37 import java.util.logging.Logger ; 38 39 44 public class AutoCommitWriteBlock extends WriteBlock { 45 private static final Logger log = Log.open(AutoCommitWriteBlock.class); 46 private static final L10N L = new L10N(AutoCommitWriteBlock.class); 47 48 public AutoCommitWriteBlock(Block block) 49 throws IOException 50 { 51 super(block); 52 53 Thread.dumpStack(); 54 55 block.read(); 58 } 59 60 63 public byte []getBuffer() 64 { 65 return _block.getBuffer(); 66 } 67 68 public void setDirty(int minDirty, int maxDirty) 69 { 70 _block.setDirty(minDirty, maxDirty); 71 } 72 73 public void setFlushDirtyOnCommit(boolean flushOnCommit) 74 { 75 _block.setFlushDirtyOnCommit(flushOnCommit); 76 } 77 78 public void commit() 79 throws IOException 80 { 81 _block.commit(); 82 } 83 84 93 94 97 protected void freeImpl() 98 { 99 super.freeImpl(); 100 101 Block block = _block; 102 _block = block; 103 104 if (block != null) { 105 try { 106 block.commit(); 107 } catch (Throwable e) { 108 log.log(Level.FINE, e.toString(), e); 109 } 110 111 block.free(); 112 113 throw new IllegalStateException (); 114 } 116 } 117 118 public String toString() 119 { 120 return "AutoCommitWriteBlock[" + getStore() + "," + getBlockId() / Store.BLOCK_SIZE + "]"; 121 } 122 } 123 | Popular Tags |