1 package com.quadcap.sql.file; 2 3 40 41 import java.io.File ; 42 import java.io.IOException ; 43 44 import java.util.Properties ; 45 46 import com.quadcap.sql.lock.Transaction; 47 48 import com.quadcap.util.Debug; 49 50 51 56 public class Log2 extends Log1 { 57 58 61 public void init(Datafile db, boolean create, Properties props) 62 throws IOException 63 { 64 super.init(db, create, props); 65 } 66 67 70 public void start() {} 71 72 75 public void addEntry(LogEntry entry) throws IOException { 76 synchronized (fileLock) { 77 super.reallyAddEntry(entry); 78 } 79 } 80 81 84 public void reallyAddEntry(LogEntry entry) throws IOException { 85 synchronized (fileLock) { 86 super.reallyAddEntry(entry); 87 } 88 } 89 90 93 public void close() throws IOException { 94 synchronized (fileLock) { 95 logger.close(); 96 reallyClose(); 97 } 98 } 99 100 101 104 public void flushLog() throws IOException { 105 synchronized (fileLock) { 106 reallyFlush(); 107 maybeCheckpoint(); 108 } 109 } 110 111 114 public void checkpoint() throws IOException { 115 synchronized (fileLock) { 116 reallyCheckpoint(); 117 } 118 } 119 120 123 public void sync() throws IOException { 124 synchronized (fileLock) { 125 } 127 } 128 129 132 public void rollbackTransaction(Transaction trans) throws IOException { 133 try { 134 synchronized (fileLock) { 135 reallyRollbackTransaction(trans); 136 } 137 } catch (Exception e) { 138 throw new DatafileException(e); 139 } 140 } 141 142 145 public void rollbackStatement(Transaction trans, int stmtId) 146 throws IOException 147 { 148 try { 149 synchronized (fileLock) { 150 reallyRollbackStatement(trans, stmtId); 151 } 152 } catch (Exception e) { 153 throw new DatafileException(e); 154 } 155 } 156 157 160 public void restart() throws Exception { 161 synchronized (fileLock) { 162 reallyRestart(); 163 } 164 } 165 } 166 167 | Popular Tags |