boolean redoCommitted, Map<Integer, Integer> mboxIDsMap, long startingTime) throws IOException, ServiceException { FileLogReader logReader = new FileLogReader(logfile, mWriteable); logReader.open(); long lastPosition = 0;   try { RedoableOp op = null; while ((op = logReader.getNextOp()) != null) { lastPosition = logReader.position();  if (mLog.isDebugEnabled()) mLog.debug("Read: " + op);  playOp(op, redoCommitted, mboxIDsMap, startingTime); } } catch (IOException e) {       mLog.warn("IOException while reading redolog file", e);  long size = logReader.getSize(); if (lastPosition < size) { long diff = size - lastPosition; String msg = "There were " + diff + " bytes of junk data at the end of " + logfile.getAbsolutePath() + "."; if (mWriteable) { mLog.warn(msg + "  File will be truncated to " + lastPosition + " bytes"); logReader.truncate(lastPosition); } else mLog.warn(msg); } } finally { logReader.close(); }
boolean redoCommitted, Map<Integer, Integer> mboxIDsMap, long startTime) throws IOException, ServiceException { scanLog(logfile, redoCommitted, mboxIDsMap, startTime, Long.MAX_VALUE);
	public void scanLog(File logfile,                        boolean redoCommitted,                        Map<Integer, Integer> mboxIDsMap,                        long startingTime)    throws IOException, ServiceException {		FileLogReader logReader = new FileLogReader(logfile, mWriteable);		logReader.open();		long lastPosition = 0;		// Read all ops in redo log, discarding those with commit/abort entries.		try {			RedoableOp op = null;			while ((op = logReader.getNextOp()) != null) {				lastPosition = logReader.position();				if (mLog.isDebugEnabled())					mLog.debug("Read: " + op);                playOp(op, redoCommitted, mboxIDsMap, startingTime);			}		} catch (IOException e) {			// The IOException could be a real I/O problem or it could mean			// there was a server crash previously and there were half-written			// log entries.  We can't really tell which case it is, so just			// assume the second case and truncate the file after the last			// successfully read item.            mLog.warn("IOException while reading redolog file", e);			long size = logReader.getSize();			if (lastPosition < size) {				long diff = size - lastPosition;                String msg =                    "There were " + diff +                    " bytes of junk data at the end of " +                    logfile.getAbsolutePath() +                    ".";                if (mWriteable) {                    mLog.warn(msg + "  File will be truncated to " +                              lastPosition + " bytes");                    logReader.truncate(lastPosition);                } else                    mLog.warn(msg);			}		} finally {			logReader.close();		}	}