private void checkAppendLog()

in activeio-core/src/main/java/org/apache/activeio/journal/active/LogFileManager.java [189:225]


    private void checkAppendLog() throws IOException {
        
        // We are trying to get the true append offset and the last Mark that was written in 
        // the append log.
        
        int offset = 0;
        Record record = new Record();
        LogFile logFile = appendNode.getLogFile();
        Location markLocation=null;
        
        while( logFile.loadAndCheckRecord(offset, record) ) {
            
            if( record.getLocation().getLogFileId()!= appendNode.getId() || record.getLocation().getLogFileOffset()!=offset ) {
                // We must have run past the end of the append location.
                break;
            }

            if ( record.getRecordType()==LogFileManager.MARK_RECORD_TYPE) {
                markLocation = record.getLocation();
            }
            
            offset += record.getRecordLength();            
        }
        
        appendNode.setAppendOffset(offset);
        
        if( markLocation!=null ) {
            try {
                Packet packet = readPacket(markLocation);
                markLocation = Location.readFromPacket(packet);
            } catch (InvalidRecordLocationException e) {
                throw (IOException)new IOException(e.getMessage()).initCause(e);
            }
            updateMark(markLocation);
        }
        
    }