00001
package com.quadcap.sql.file;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
import java.io.File;
00042
import java.io.IOException;
00043
00044
import java.util.Properties;
00045
00046
import com.quadcap.sql.lock.Transaction;
00047
00048
import com.quadcap.util.Debug;
00049
00050
00051
00052
00053
00054
00055
00056 public class Log2 extends Log1 {
00057
00058
00059
00060
00061 public void init(
Datafile db,
boolean create, Properties props)
00062
throws IOException
00063 {
00064 super.init(db, create, props);
00065 }
00066
00067
00068
00069
00070 public void start() {}
00071
00072
00073
00074
00075 public void addEntry(
LogEntry entry)
throws IOException {
00076
synchronized (fileLock) {
00077 super.reallyAddEntry(entry);
00078 }
00079 }
00080
00081
00082
00083
00084 public void reallyAddEntry(
LogEntry entry)
throws IOException {
00085
synchronized (fileLock) {
00086 super.reallyAddEntry(entry);
00087 }
00088 }
00089
00090
00091
00092
00093 public void close() throws IOException {
00094
synchronized (fileLock) {
00095 logger.
close();
00096
reallyClose();
00097 }
00098 }
00099
00100
00101
00102
00103
00104 public void flushLog() throws IOException {
00105
synchronized (fileLock) {
00106
reallyFlush();
00107
maybeCheckpoint();
00108 }
00109 }
00110
00111
00112
00113
00114 public void checkpoint() throws IOException {
00115
synchronized (fileLock) {
00116
reallyCheckpoint();
00117 }
00118 }
00119
00120
00121
00122
00123 public void sync() throws IOException {
00124
synchronized (fileLock) {
00125
00126 }
00127 }
00128
00129
00130
00131
00132 public void rollbackTransaction(
Transaction trans)
throws IOException {
00133
try {
00134
synchronized (fileLock) {
00135 reallyRollbackTransaction(trans);
00136 }
00137 }
catch (Exception e) {
00138
throw new DatafileException(e);
00139 }
00140 }
00141
00142
00143
00144
00145 public void rollbackStatement(
Transaction trans,
int stmtId)
00146
throws IOException
00147 {
00148
try {
00149
synchronized (fileLock) {
00150 reallyRollbackStatement(trans, stmtId);
00151 }
00152 }
catch (Exception e) {
00153
throw new DatafileException(e);
00154 }
00155 }
00156
00157
00158
00159
00160 public void restart() throws Exception {
00161
synchronized (fileLock) {
00162
reallyRestart();
00163 }
00164 }
00165 }
00166