1 23 24 package org.objectweb.cjdbc.controller.recoverylog.events; 25 26 import java.sql.SQLException ; 27 28 import org.objectweb.cjdbc.common.i18n.Translate; 29 import org.objectweb.cjdbc.controller.recoverylog.LoggerThread; 30 31 37 public class ResetLogEvent implements LogEvent 38 { 39 private long oldId; 40 private long newId; 41 private String checkpointName; 42 43 50 public ResetLogEvent(long oldCheckpointId, long newCheckpointId, 51 String checkpointName) 52 { 53 this.oldId = oldCheckpointId; 54 this.newId = newCheckpointId; 55 this.checkpointName = checkpointName; 56 } 57 58 61 public boolean belongToTransaction(long tid) 62 { 63 return false; 64 } 65 66 69 public void execute(LoggerThread loggerThread) 70 { 71 try 72 { 73 loggerThread.deleteCheckpointTable(); 74 loggerThread.storeCheckpoint(checkpointName, newId); 75 loggerThread.deleteLogEntriesBeforeId(oldId); 76 loggerThread.shiftLogEntriesIds(newId - oldId); 77 } 78 catch (SQLException e) 79 { 80 loggerThread.invalidateLogStatements(); 81 loggerThread.getLogger().error( 82 Translate.get("recovery.jdbc.loggerthread.log.reset.failed", 83 checkpointName), e); 84 loggerThread.putBackAtHeadOfQueue(this); 86 } 87 } 88 89 } 90 | Popular Tags |