1 21 22 package org.continuent.sequoia.controller.recoverylog.events; 23 24 import java.sql.SQLException ; 25 26 import org.continuent.sequoia.controller.recoverylog.LoggerThread; 27 28 35 public class GetNumberOfLogEntriesEvent implements LogEvent 36 { 37 private long lowerId; 38 private long upperId; 39 private long nbOfLogEntries; 40 41 47 public GetNumberOfLogEntriesEvent(long lowerLogId, long upperLogId) 48 { 49 this.lowerId = lowerLogId; 50 this.upperId = upperLogId; 51 } 52 53 56 public boolean belongToTransaction(long tid) 57 { 58 return false; 59 } 60 61 64 public void execute(LoggerThread loggerThread) 65 { 66 try 67 { 68 nbOfLogEntries = loggerThread.getNumberOfLogEntries(lowerId, upperId); 69 } 70 catch (SQLException e) 71 { 72 loggerThread.invalidateLogStatements(); 73 loggerThread.getLogger().error( 74 "Failed to retrieve number of log entries", e); 75 loggerThread.putBackAtHeadOfQueue(this, e); 77 } 78 finally 79 { 80 synchronized (this) 81 { 82 notify(); 83 } 84 } 85 } 86 87 93 public long getNbOfLogEntries() 94 { 95 return nbOfLogEntries; 96 } 97 98 101 public String toString() 102 { 103 return "Get number of log entries between " + lowerId + " and " + upperId; 104 } 105 106 } 107 | Popular Tags |