You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/05 18:28:50 UTC

svn commit: r1227712 [1/2] - in /directory/apacheds/branches/apacheds-txns/core-shared/src: main/java/org/apache/directory/server/core/shared/ main/java/org/apache/directory/server/core/shared/log/ main/java/org/apache/directory/server/core/shared/part...

Author: elecharny
Date: Thu Jan  5 17:28:50 2012
New Revision: 1227712

URL: http://svn.apache.org/viewvc?rev=1227712&view=rev
Log:
Formatted the doc for better diffs.

Modified:
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/ReferralManagerImpl.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogFileManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogScanner.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileRecords.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFlushManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/EntryCursorAdaptor.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/TxnManagerFactory.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/log/LogFileManagerTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/log/LogFlushScanTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/log/LogTest.java

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java Thu Jan  5 17:28:50 2012
@@ -92,7 +92,7 @@ public class DefaultDnFactory implements
 
             if ( dnCacheEntry != null )
             {
-                cachedDn = (Dn) dnCacheEntry.getObjectValue();
+                cachedDn = ( Dn ) dnCacheEntry.getObjectValue();
             }
         }
 
@@ -104,7 +104,7 @@ public class DefaultDnFactory implements
 
             if ( dnCache != null )
             {
-                dnCache.put( new Element( dn, cachedDn) );
+                dnCache.put( new Element( dn, cachedDn ) );
             }
 
             if ( enableStats )

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/ReferralManagerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/ReferralManagerImpl.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/ReferralManagerImpl.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/ReferralManagerImpl.java Thu Jan  5 17:28:50 2012
@@ -81,7 +81,8 @@ public class ReferralManagerImpl impleme
         Set<String> suffixes = nexus.listSuffixes();
         OBJECT_CLASS_AT = directoryService.getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
 
-        init( directoryService, suffixes.toArray( new String[]{} ) );
+        init( directoryService, suffixes.toArray( new String[]
+            {} ) );
 
         unlock();
     }
@@ -161,12 +162,13 @@ public class ReferralManagerImpl impleme
         CoreSession adminSession = directoryService.getAdminSession();
         PartitionNexus nexus = directoryService.getPartitionNexus();
 
-        for ( String suffix:suffixes )
+        for ( String suffix : suffixes )
         {
             // We will store each entry's Dn into the Referral tree
             Dn suffixDn = directoryService.getDnFactory().create( suffix );
 
-            SearchOperationContext searchOperationContext = new SearchOperationContext( adminSession, suffixDn, referralFilter, searchControl );
+            SearchOperationContext searchOperationContext = new SearchOperationContext( adminSession, suffixDn,
+                referralFilter, searchControl );
             searchOperationContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
             EntryFilteringCursor cursor = nexus.search( searchOperationContext );
 

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java Thu Jan  5 17:28:50 2012
@@ -59,7 +59,7 @@ public class SchemaService
 {
     /** cached version of the schema subentry with all attributes in it */
     private static Entry schemaSubentry;
-    
+
     /** A lock to avid concurrent generation of the SubschemaSubentry */
     private static Object schemaSubentrLock = new Object();
 
@@ -69,7 +69,7 @@ public class SchemaService
      */
     private static Attribute generateComparators( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COMPARATORS_AT ) );
 
         for ( LdapComparator<?> comparator : schemaManager.getComparatorRegistry() )
@@ -83,11 +83,11 @@ public class SchemaService
 
     private static Attribute generateNormalizers( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.NORMALIZERS_AT ) );
 
         NormalizerRegistry nr = schemaManager.getNormalizerRegistry();
-        
+
         for ( Normalizer normalizer : nr )
         {
             attr.add( SchemaUtils.render( normalizer ) );
@@ -99,14 +99,14 @@ public class SchemaService
 
     private static Attribute generateSyntaxCheckers( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.SYNTAX_CHECKERS_AT ) );
 
         for ( SyntaxChecker syntaxChecker : schemaManager.getSyntaxCheckerRegistry() )
         {
             attr.add( SchemaUtils.render( syntaxChecker ) );
         }
-        
+
         return attr;
     }
 
@@ -127,7 +127,7 @@ public class SchemaService
 
     private static Attribute generateAttributeTypes( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT ) );
 
         for ( AttributeType attributeType : schemaManager.getAttributeTypeRegistry() )
@@ -141,7 +141,7 @@ public class SchemaService
 
     private static Attribute generateMatchingRules( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.MATCHING_RULES_AT ) );
 
         for ( MatchingRule matchingRule : schemaManager.getMatchingRuleRegistry() )
@@ -169,7 +169,7 @@ public class SchemaService
 
     private static Attribute generateSyntaxes( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.LDAP_SYNTAXES_AT ) );
 
         for ( LdapSyntax syntax : schemaManager.getLdapSyntaxRegistry() )
@@ -183,42 +183,42 @@ public class SchemaService
 
     private static Attribute generateDitContextRules( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.DIT_CONTENT_RULES_AT ) );
 
         for ( DITContentRule ditContentRule : schemaManager.getDITContentRuleRegistry() )
         {
             attr.add( SchemaUtils.render( ditContentRule ).toString() );
         }
-        
+
         return attr;
     }
 
 
     private static Attribute generateDitStructureRules( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.DIT_STRUCTURE_RULES_AT ) );
 
         for ( DITStructureRule ditStructureRule : schemaManager.getDITStructureRuleRegistry() )
         {
             attr.add( SchemaUtils.render( ditStructureRule ).toString() );
         }
-        
+
         return attr;
     }
 
 
     private static Attribute generateNameForms( SchemaManager schemaManager ) throws LdapException
     {
-        Attribute attr = new DefaultAttribute( 
+        Attribute attr = new DefaultAttribute(
             schemaManager.getAttributeType( SchemaConstants.NAME_FORMS_AT ) );
 
         for ( NameForm nameForm : schemaManager.getNameFormRegistry() )
         {
             attr.add( SchemaUtils.render( nameForm ).toString() );
         }
-        
+
         return attr;
     }
 
@@ -231,7 +231,7 @@ public class SchemaService
         Entry attrs = new DefaultEntry( schemaManager, mods.getDn() );
 
         // add the objectClass attribute : 'top', 'subschema', 'subentry' and 'apacheSubschema' 
-        attrs.put( SchemaConstants.OBJECT_CLASS_AT, 
+        attrs.put( SchemaConstants.OBJECT_CLASS_AT,
             SchemaConstants.TOP_OC,
             SchemaConstants.SUBSCHEMA_OC,
             SchemaConstants.SUBENTRY_OC,
@@ -303,20 +303,20 @@ public class SchemaService
         {
             if ( schemaSubentry == null )
             {
-                Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(), 
+                Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(),
                     SchemaConstants.SCHEMA_MODIFICATIONS_DN );
 
-                generateSchemaSubentry( 
-                    directoryService.getSchemaManager(), 
+                generateSchemaSubentry(
+                    directoryService.getSchemaManager(),
                     directoryService.getSchemaPartition().lookup(
-                        new LookupOperationContext( null, schemaModificationAttributesDn) ) );
+                        new LookupOperationContext( null, schemaModificationAttributesDn ) ) );
             }
-    
+
             return ( Entry ) schemaSubentry.clone();
         }
     }
-    
-    
+
+
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.schema.SchemaService#getSubschemaEntryCloned()
      */
@@ -324,13 +324,13 @@ public class SchemaService
     {
         if ( schemaSubentry == null )
         {
-            Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(), 
+            Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(),
                 SchemaConstants.SCHEMA_MODIFICATIONS_DN );
 
-            generateSchemaSubentry( 
-                directoryService.getSchemaManager(), 
+            generateSchemaSubentry(
+                directoryService.getSchemaManager(),
                 directoryService.getSchemaPartition().lookup(
-                    new LookupOperationContext( null, schemaModificationAttributesDn) ) );
+                    new LookupOperationContext( null, schemaModificationAttributesDn ) ) );
         }
 
         return ( Entry ) schemaSubentry.clone();
@@ -346,62 +346,63 @@ public class SchemaService
         {
             ids = StringConstants.EMPTY_STRINGS;
         }
-        
+
         SchemaManager schemaManager = directoryService.getSchemaManager();
 
         Set<String> setOids = new HashSet<String>();
         Entry attrs = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
         boolean returnAllOperationalAttributes = false;
 
-        synchronized( schemaSubentrLock )
+        synchronized ( schemaSubentrLock )
         {
             // ---------------------------------------------------------------
             // Check if we need an update by looking at timestamps on disk
             // ---------------------------------------------------------------
-            Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(), 
+            Dn schemaModificationAttributesDn = new Dn( directoryService.getSchemaManager(),
                 SchemaConstants.SCHEMA_MODIFICATIONS_DN );
 
-            Entry mods = 
-                directoryService.getSchemaPartition().lookup( 
-                    new LookupOperationContext( null, schemaModificationAttributesDn, SchemaConstants.ALL_ATTRIBUTES_ARRAY ) );
-            
-// @todo enable this optimization at some point but for now it
-// is causing some problems so I will just turn it off
-//          Attribute modifyTimeDisk = mods.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
-//
-//          Attribute modifyTimeMemory = null;
-//
-//            if ( schemaSubentry != null )
-//            {
-//                modifyTimeMemory = schemaSubentry.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
-//                if ( modifyTimeDisk == null && modifyTimeMemory == null )
-//                {
-//                    // do nothing!
-//                }
-//                else if ( modifyTimeDisk != null && modifyTimeMemory != null )
-//                {
-//                    Date disk = DateUtils.getDate( ( String ) modifyTimeDisk.get() );
-//                    Date mem = DateUtils.getDate( ( String ) modifyTimeMemory.get() );
-//                    if ( disk.after( mem ) )
-//                    {
-//                        generateSchemaSubentry( mods );
-//                    }
-//                }
-//                else
-//                {
-//                    generateSchemaSubentry( mods );
-//                }
-//            }
-//            else
-//            {
-                generateSchemaSubentry( schemaManager, mods );
-//            }
+            Entry mods =
+                directoryService.getSchemaPartition().lookup(
+                    new LookupOperationContext( null, schemaModificationAttributesDn,
+                        SchemaConstants.ALL_ATTRIBUTES_ARRAY ) );
+
+            // @todo enable this optimization at some point but for now it
+            // is causing some problems so I will just turn it off
+            //          Attribute modifyTimeDisk = mods.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
+            //
+            //          Attribute modifyTimeMemory = null;
+            //
+            //            if ( schemaSubentry != null )
+            //            {
+            //                modifyTimeMemory = schemaSubentry.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
+            //                if ( modifyTimeDisk == null && modifyTimeMemory == null )
+            //                {
+            //                    // do nothing!
+            //                }
+            //                else if ( modifyTimeDisk != null && modifyTimeMemory != null )
+            //                {
+            //                    Date disk = DateUtils.getDate( ( String ) modifyTimeDisk.get() );
+            //                    Date mem = DateUtils.getDate( ( String ) modifyTimeMemory.get() );
+            //                    if ( disk.after( mem ) )
+            //                    {
+            //                        generateSchemaSubentry( mods );
+            //                    }
+            //                }
+            //                else
+            //                {
+            //                    generateSchemaSubentry( mods );
+            //                }
+            //            }
+            //            else
+            //            {
+            generateSchemaSubentry( schemaManager, mods );
+            //            }
 
             // ---------------------------------------------------------------
             // Prep Work: Transform the attributes to their OID counterpart
             // ---------------------------------------------------------------
 
-            for ( String id:ids )
+            for ( String id : ids )
             {
                 // Check whether the set contains a plus, and use it below to include all
                 // operational attributes.  Due to RFC 3673, and issue DIREVE-228 in JIRA
@@ -409,7 +410,7 @@ public class SchemaService
                 {
                     returnAllOperationalAttributes = true;
                 }
-                else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals(  id ) )
+                else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals( id ) )
                 {
                     setOids.add( id );
                 }
@@ -480,7 +481,7 @@ public class SchemaService
             }
 
             int minSetSize = 0;
-            
+
             if ( setOids.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
             {
                 minSetSize++;
@@ -498,16 +499,16 @@ public class SchemaService
 
             // add the objectClass attribute
             if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
-                 setOids.contains( SchemaConstants.OBJECT_CLASS_AT_OID ) ||
-                 setOids.size() == minSetSize )
+                setOids.contains( SchemaConstants.OBJECT_CLASS_AT_OID ) ||
+                setOids.size() == minSetSize )
             {
                 addAttribute( attrs, SchemaConstants.OBJECT_CLASS_AT );
             }
 
             // add the cn attribute as required for the Rdn
             if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
-                 setOids.contains( SchemaConstants.CN_AT_OID ) ||
-                 setOids.size() == minSetSize )
+                setOids.contains( SchemaConstants.CN_AT_OID ) ||
+                setOids.size() == minSetSize )
             {
                 addAttribute( attrs, SchemaConstants.CN_AT );
             }
@@ -516,7 +517,6 @@ public class SchemaService
             // set standard operational attributes for the subentry
             // -------------------------------------------------------------------
 
-
             if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) )
             {
                 addAttribute( attrs, SchemaConstants.CREATE_TIMESTAMP_AT );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java Thu Jan  5 17:28:50 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.log;
 
+
 import java.io.IOException;
 import org.apache.directory.server.core.api.log.Log;
 import org.apache.directory.server.core.api.log.LogScanner;
@@ -27,6 +28,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.core.api.log.InvalidLogException;
 
+
 /**
  * Log interface default Implementation. 
  * 
@@ -36,47 +38,49 @@ public class DefaultLog implements Log
 {
     /** Log manager */
     LogManager logManager;
-    
+
     /** Log File Manager */
     LogFileManager logFileManager;
-    
+
     /** LogFlushManager */
     LogFlushManager logFlushManager;
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public void init( String logFilepath, String suffix, int logBufferSize, long logFileSize ) throws IOException, InvalidLogException
+    public void init( String logFilepath, String suffix, int logBufferSize, long logFileSize ) throws IOException,
+        InvalidLogException
     {
-       logFileManager = new DefaultLogFileManager( logFilepath, suffix );
-       
-       logManager = new LogManager( logFileManager );
-       logManager.initLogManager();
-       
-       logFlushManager = new LogFlushManager( logManager, logBufferSize, logFileSize );
+        logFileManager = new DefaultLogFileManager( logFilepath, suffix );
+
+        logManager = new LogManager( logFileManager );
+        logManager.initLogManager();
+
+        logFlushManager = new LogFlushManager( logManager, logBufferSize, logFileSize );
     }
-    
-    
-   /**
-    * {@inheritDoc}
-    */
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void log( UserLogRecord userRecord, boolean sync ) throws IOException, InvalidLogException
     {
         logFlushManager.append( userRecord, sync );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public LogScanner beginScan( LogAnchor startPoint )
     {
         LogScanner logScanner = new DefaultLogScanner( startPoint, logFileManager );
-        
+
         return logScanner;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -84,29 +88,29 @@ public class DefaultLog implements Log
     {
         LogAnchor startPoint = new LogAnchor();
         LogScanner logScanner = new DefaultLogScanner( startPoint, logFileManager );
-        
+
         return logScanner;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public void advanceMinNeededLogPosition( LogAnchor newAnchor )
     {
-       logManager.advanceMinLogAnchor( newAnchor ); 
+        logManager.advanceMinLogAnchor( newAnchor );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public void sync( long uptoLSN ) throws IOException, InvalidLogException
     {
-       logFlushManager.sync( uptoLSN ); 
+        logFlushManager.sync( uptoLSN );
     }
-    
-    
+
+
     /**
      * @see Object#toString()
      */

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogFileManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogFileManager.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogFileManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogFileManager.java Thu Jan  5 17:28:50 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.log;
 
+
 import java.io.EOFException;
 import java.io.File;
 import java.io.IOException;
@@ -26,6 +27,7 @@ import java.io.FileNotFoundException;
 
 import java.io.RandomAccessFile;
 
+
 /**
  * Creates and manages a LogFile on disk. The file name is the concatenation of a 
  * path on disk, and of a suffix.<br/>
@@ -33,14 +35,15 @@ import java.io.RandomAccessFile;
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/* Package protected */ class DefaultLogFileManager implements LogFileManager 
+/* Package protected */class DefaultLogFileManager implements LogFileManager
 {
     /** The Log file path */
     private String logFilePath;
-    
+
     /** The Log file suffix */
     private String suffix;
-    
+
+
     /**
      * Creates a log file manager to use the given logfile path and the suffix. Each log file
      * has name logFileName_<logFileNumber>.suffix 
@@ -53,44 +56,44 @@ import java.io.RandomAccessFile;
         this.logFilePath = logFilePath;
         this.suffix = suffix;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public LogFileReader getReaderForLogFile( long logFileNumber ) throws IOException, FileNotFoundException
     {
         File logFile = makeLogFileName( logFileNumber );
-        
+
         return new LogFileReader( logFile, logFileNumber );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public LogFileWriter getWriterForLogFile( long logFileNumber ) throws IOException, FileNotFoundException
     {
         File logFile = makeLogFileName( logFileNumber );
-        
+
         return new LogFileWriter( logFile, logFileNumber );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public boolean createLogFile( long logFileNumber ) throws IOException
     {
         File logFile = makeLogFileName( logFileNumber );
-        
+
         // Create the files, unless it already exists.
         boolean fileAlreadyExists = !logFile.createNewFile();
-        
+
         return fileAlreadyExists;
     }
-    
-       
+
+
     /**
      * {@inheritDoc}
      */
@@ -98,52 +101,54 @@ import java.io.RandomAccessFile;
     {
         if ( size < 0 )
         {
-            throw new IllegalArgumentException( "Invalid file size is specified for the log file: " + logFileNumber + " " + size );
+            throw new IllegalArgumentException( "Invalid file size is specified for the log file: " + logFileNumber
+                + " " + size );
         }
-        
+
         File logFile = makeLogFileName( logFileNumber );
-        
+
         // This will throw a file not found exception if file does not exist
         RandomAccessFile raf = new RandomAccessFile( logFile, "rw" );
-        
+
         // Now, truncate the file for real
         raf.setLength( size );
         raf.getFD().sync();
         raf.close();
     }
-    
-   
+
+
     /**
      * {@inheritDoc}
      */
     public void deleteLogFile( long logFileNumber )
     {
         File logFile = makeLogFileName( logFileNumber );
-        
+
         logFile.delete();
     }
-    
-   
+
+
     /**
      * {@inheritDoc}
      */
-    public boolean rename(long originalLogFileNumber, long newLongFileNumber)
+    public boolean rename( long originalLogFileNumber, long newLongFileNumber )
     {
-        File oldLogFile = makeLogFileName( originalLogFileNumber );  
+        File oldLogFile = makeLogFileName( originalLogFileNumber );
         boolean result = oldLogFile.renameTo( makeLogFileName( newLongFileNumber ) );
-        
+
         return result;
     }
-    
+
+
     /**
      * Creates a log file name using the path, the prefix and the suffix
      */
     private File makeLogFileName( long logFileNumber )
     {
-        return new File( logFilePath + File.separatorChar + LogFileManager.LOG_NAME_PREFIX + logFileNumber + "." + suffix );
+        return new File( logFilePath + File.separatorChar + LogFileManager.LOG_NAME_PREFIX + logFileNumber + "."
+            + suffix );
     }
-    
-    
+
     /**
      * An implementation of the {@link LogFileManager.LogFileReader} interface.
      */
@@ -151,20 +156,20 @@ import java.io.RandomAccessFile;
     {
         /** Underlying log file */
         RandomAccessFile raf;
-        
+
         /** Log file identifier */
         long logFileNumber;
-        
-  
+
+
         public LogFileReader( File logFile, long logFileNumber ) throws FileNotFoundException
         {
             // This will throw a file not found exception if file does not exist
             raf = new RandomAccessFile( logFile, "r" );
-            
+
             this.logFileNumber = logFileNumber;
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -174,8 +179,8 @@ import java.io.RandomAccessFile;
             // it does not span across blocks of data
             raf.readFully( buffer, offset, length );
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -183,8 +188,8 @@ import java.io.RandomAccessFile;
         {
             raf.seek( position );
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -192,8 +197,8 @@ import java.io.RandomAccessFile;
         {
             raf.close();
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -201,8 +206,8 @@ import java.io.RandomAccessFile;
         {
             return logFileNumber;
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -210,8 +215,8 @@ import java.io.RandomAccessFile;
         {
             return raf.length();
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -219,8 +224,8 @@ import java.io.RandomAccessFile;
         {
             return raf.getFilePointer();
         }
-        
-        
+
+
         /**
          * @see Object#toString()
          */
@@ -229,8 +234,7 @@ import java.io.RandomAccessFile;
             return "FileReader(" + raf + ", " + logFileNumber + ")";
         }
     }
-    
-    
+
     /**
      * An implementation of the {@link LogFileManager.LogFileWriter} interface.
      */
@@ -238,11 +242,11 @@ import java.io.RandomAccessFile;
     {
         /** Underlying log file */
         RandomAccessFile raf;
-        
+
         /** Log file identifier */
         long logFileNumber;
-        
-  
+
+
         /**
          * Creates an instance of a LogFileWriter
          * 
@@ -255,11 +259,11 @@ import java.io.RandomAccessFile;
         {
             // This will throw a file not found exception if file does not exist
             raf = new RandomAccessFile( logFile, "rw" );
-            
+
             this.logFileNumber = logFileNumber;
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -267,17 +271,17 @@ import java.io.RandomAccessFile;
         {
             raf.write( buffer, offset, length );
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
         public void sync() throws IOException
         {
-             raf.getFD().sync();
+            raf.getFD().sync();
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -285,17 +289,17 @@ import java.io.RandomAccessFile;
         {
             raf.close();
         }
-        
-        
-         /**
-          * {@inheritDoc}
-          */
+
+
+        /**
+         * {@inheritDoc}
+         */
         public long logFileNumber()
         {
             return logFileNumber;
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -303,8 +307,8 @@ import java.io.RandomAccessFile;
         {
             return raf.length();
         }
-        
-        
+
+
         /**
          * {@inheritDoc}
          */
@@ -312,8 +316,8 @@ import java.io.RandomAccessFile;
         {
             raf.seek( position );
         }
-        
-        
+
+
         /**
          * @see Object#toString()
          */

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogScanner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogScanner.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogScanner.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLogScanner.java Thu Jan  5 17:28:50 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.log;
 
+
 import java.io.IOException;
 import java.io.EOFException;
 import java.io.FileNotFoundException;
@@ -33,6 +34,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.log.InvalidLogException;
 import org.apache.directory.server.core.shared.log.LogFileManager.LogFileReader;
 
+
 /**
  * An implementation of a LogScanner.
  * 
@@ -42,37 +44,38 @@ public class DefaultLogScanner implement
 {
     /** LSN of the last successfully read log record */
     private long prevLSN = LogAnchor.UNKNOWN_LSN;
-    
+
     /** File number of the last successfully read position's file number */
     private long prevLogFileNumber = -1;
-    
+
     /** File number of the last known good offset */
     private long prevLogFileOffset = -1;
-    
+
     /** Position to read the next record from */
     private LogAnchor startingLogAnchor = new LogAnchor();
-    
+
     /** Last Read Lsn */
     private long lastReadLSN = LogAnchor.UNKNOWN_LSN;
-    
+
     /** Current log file pointer to read from */
     private LogFileManager.LogFileReader currentLogFile;
-    
+
     /** True if scanner is closed */
     private boolean closed = false;
-    
+
     /** True if scanner hit invalid content. No more reads will be done after invalid log content is hit */
     private boolean invalidLog = false;
-    
+
     /** log file manager used to open files for reading */
     private LogFileManager logFileManager;
-    
+
     /** ByteBuffer wrapper for the marker buffer */
     private ByteBuffer markerHead = ByteBuffer.allocate( LogFileRecords.MAX_MARKER_SIZE );
 
     /** The Checksum used */
     private Checksum checksum = new Adler32();
 
+
     /**
      * Creates a new instance of a LogScanner.
      * 
@@ -84,40 +87,40 @@ public class DefaultLogScanner implement
         this.startingLogAnchor.resetLogAnchor( startingLogAnchor );
         this.logFileManager = logFileManager;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public boolean getNextRecord( UserLogRecord logRecord ) throws IOException, InvalidLogException
     {
         boolean startingRead = false;
-        
+
         checkIfClosed();
-        
+
         if ( invalidLog )
         {
             throw new InvalidLogException( I18n.err( I18n.ERR_750 ) );
         }
-        
+
         long fileLength;
         long fileOffset;
-        
+
         try
         {
             if ( currentLogFile == null )
             {
                 // We haven't yet opened a LogFile. Let's do it right away
                 long startingOffset = startingLogAnchor.getLogFileOffset();
-                
+
                 // Read and verify header
                 currentLogFile = readFileHeader( startingLogAnchor.getLogFileNumber() );
-                
+
                 if ( currentLogFile == null )
                 {
                     return false; // Nothing to read
                 }
-    
+
                 if ( startingOffset > 0 )
                 {
                     if ( startingOffset < LogFileRecords.LOG_FILE_HEADER_SIZE )
@@ -125,21 +128,21 @@ public class DefaultLogScanner implement
                         // Offset should be at log file marker boundary
                         markScanInvalid( null );
                     }
-                    
+
                     prevLogFileOffset = Math.min( startingOffset, currentLogFile.getLength() );
-                    
+
                     // Move to the beginning of the data we want to read.
                     currentLogFile.seek( prevLogFileOffset );
                 }
-                
+
                 startingRead = true;
             }
-            
+
             while ( true )
             {
                 fileLength = currentLogFile.getLength();
-                fileOffset = currentLogFile.getOffset(); 
-                
+                fileOffset = currentLogFile.getOffset();
+
                 if ( fileOffset > fileLength )
                 {
                     markScanInvalid( null );
@@ -150,74 +153,75 @@ public class DefaultLogScanner implement
                     long nextLogFileNumber = currentLogFile.logFileNumber() + 1;
                     currentLogFile.close();
                     currentLogFile = readFileHeader( nextLogFileNumber );
-                    
+
                     if ( currentLogFile == null )
-                    {   
+                    {
                         return false; // Done. End of log stream
                     }
                 }
                 else
                 {
-                    break;  // break to read the user record
+                    break; // break to read the user record
                 }
             }
-            
+
             // Read and verify record header
             int recordLength = readRecordHeader();
-            
+
             // If starting read, then check if we have the expected lsn in case
             // expected lsn is known
             if ( startingRead )
             {
                 long startingLSN = startingLogAnchor.getLogLSN();
-                
+
                 if ( ( startingLSN != LogAnchor.UNKNOWN_LSN ) && ( startingLSN != lastReadLSN ) )
                 {
                     markScanInvalid( null );
                 }
             }
-            
+
             // Read and verify the user block
-            readLogRecord( logRecord, recordLength - ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE ));
-            
+            readLogRecord( logRecord, recordLength
+                - ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE ) );
+
             // Read and verify footer
             checksum.reset();
             checksum.update( logRecord.getDataBuffer(), 0, logRecord.getDataLength() );
-            readRecordFooter( (int)checksum.getValue() );
-            
+            readRecordFooter( ( int ) checksum.getValue() );
+
             // If we are here, then we successfully read the log record. 
             // Set the read record's position, uptate last read good location
             // and then return
             fileOffset = currentLogFile.getOffset();
-            
+
             LogAnchor userLogAnchor = logRecord.getLogAnchor();
             userLogAnchor.resetLogAnchor( currentLogFile.logFileNumber(), fileOffset - recordLength, lastReadLSN );
-            
+
             prevLogFileOffset = fileOffset;
             prevLogFileNumber = currentLogFile.logFileNumber();
             prevLSN = lastReadLSN;
         }
-        catch( EOFException e)
+        catch ( EOFException e )
         {
             // This means either the log record or the log file header was
             // partially written. Treat this as invalid log content
             markScanInvalid( e );
         }
-        catch( IOException e)
+        catch ( IOException e )
         {
             close();
             throw e;
         }
-        catch( InvalidLogException e)
+        catch ( InvalidLogException e )
         {
             close();
             throw e;
         }
-        
+
         return true;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -225,8 +229,8 @@ public class DefaultLogScanner implement
     {
         return prevLogFileNumber;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -234,8 +238,8 @@ public class DefaultLogScanner implement
     {
         return prevLogFileOffset;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -244,23 +248,23 @@ public class DefaultLogScanner implement
         if ( closed == false )
         {
             closed = true;
-            
-            if (currentLogFile != null)
+
+            if ( currentLogFile != null )
             {
                 try
                 {
                     currentLogFile.close();
                     currentLogFile = null;
                 }
-                catch( IOException e )
+                catch ( IOException e )
                 {
                     // Ignore
                 }
             }
         }
     }
-    
-    
+
+
     /**
      * Read the user record header
      */
@@ -272,66 +276,65 @@ public class DefaultLogScanner implement
         int length = markerHead.getInt();
         long lsn = markerHead.getLong();
         long checksum = markerHead.getLong();
-        
+
         if ( ( magicNumber != LogFileRecords.RECORD_HEADER_MAGIC_NUMBER ) ||
-             ( length <= ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE ) ) ||
-             ( lsn < prevLSN ) || 
-             ( checksum != ( lsn ^ length ) ) )
+            ( length <= ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE ) ) ||
+            ( lsn < prevLSN ) ||
+            ( checksum != ( lsn ^ length ) ) )
         {
             markScanInvalid( null );
         }
-        
+
         // Everything went fine
         lastReadLSN = lsn;
-        
+
         return length;
     }
-    
-    
+
+
     /**
      * Read the user record footer.
      */
-    private void readRecordFooter( int expectedChecksum ) throws IOException, InvalidLogException, EOFException 
+    private void readRecordFooter( int expectedChecksum ) throws IOException, InvalidLogException, EOFException
     {
         markerHead.rewind();
         currentLogFile.read( markerHead.array(), 0, LogFileRecords.RECORD_FOOTER_SIZE );
-        
+
         // The checksum
         int checksum = markerHead.getInt();
-        
+
         // The magicNumber
         int magicNumber = markerHead.getInt();
-        
-      
-        if ( ( magicNumber != LogFileRecords.RECORD_FOOTER_MAGIC_NUMBER ) || 
-             ( expectedChecksum != checksum ) )
+
+        if ( ( magicNumber != LogFileRecords.RECORD_FOOTER_MAGIC_NUMBER ) ||
+            ( expectedChecksum != checksum ) )
         {
             markScanInvalid( null );
         }
     }
-    
-    
+
+
     /**
      * Read the data from the LogFile, excluding the header and footer. 
      */
     private void readLogRecord( UserLogRecord userRecord, int length ) throws IOException, EOFException
     {
         byte dataBuffer[] = userRecord.getDataBuffer();
-        
+
         if ( ( dataBuffer == null ) || ( dataBuffer.length < length ) )
         {
             // Allocate a larger buffer
             dataBuffer = new byte[length];
         }
-        
+
         currentLogFile.read( dataBuffer, 0, length );
-        
+
         // The size we read can be different from the bufer size, if we reused the 
         // buffer from a previous read.
         userRecord.setData( dataBuffer, length );
     }
-    
-    
+
+
     /**
      * Read the file header. It's a 12 bytes array, containing the file number (a long, on 8 bytes)
      * and the magic number (on 4 bytes).
@@ -339,8 +342,7 @@ public class DefaultLogScanner implement
     private LogFileReader readFileHeader( long logFileNumber ) throws IOException, InvalidLogException, EOFException
     {
         LogFileReader logFileReader;
-        
-        
+
         // Get a reader on the logFile
         try
         {
@@ -350,35 +352,36 @@ public class DefaultLogScanner implement
         {
             return null; // end of log scan
         }
-        
+
         // File exists
         prevLogFileNumber = logFileNumber;
         prevLogFileOffset = 0;
-        
+
         markerHead.rewind();
-        
+
         // Read the Header
         logFileReader.read( markerHead.array(), 0, LogFileRecords.LOG_FILE_HEADER_SIZE );
-        
+
         // The file number
         long persistedLogFileNumber = markerHead.getLong();
-        
+
         // The magic number
         int magicNumber = markerHead.getInt();
-      
+
         // Check both values
-        if ( ( persistedLogFileNumber != logFileNumber ) || 
-             ( magicNumber != LogFileRecords.LOG_FILE_HEADER_MAGIC_NUMBER ) )
+        if ( ( persistedLogFileNumber != logFileNumber ) ||
+            ( magicNumber != LogFileRecords.LOG_FILE_HEADER_MAGIC_NUMBER ) )
         {
             markScanInvalid( null );
         }
-        
+
         // Everything is fine advance last good offset and return
         prevLogFileOffset = LogFileRecords.LOG_FILE_HEADER_SIZE;
-        
+
         return logFileReader;
     }
-    
+
+
     /**
      * Verify that the Log is not closed.
      */
@@ -389,8 +392,8 @@ public class DefaultLogScanner implement
             throw new IllegalStateException( I18n.err( I18n.ERR_749 ) );
         }
     }
-    
-    
+
+
     /**
      * Mark the file as invalid and throw an InvalidLogException
      */

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileManager.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileManager.java Thu Jan  5 17:28:50 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.log;
 
+
 import java.io.IOException;
 import java.io.EOFException;
 import java.io.FileNotFoundException;
@@ -29,11 +30,12 @@ import java.io.FileNotFoundException;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/* Package protected */ interface LogFileManager
+/* Package protected */interface LogFileManager
 {
     /** The log file prefix */
-    final static String LOG_NAME_PREFIX = "log_"; 
-  
+    final static String LOG_NAME_PREFIX = "log_";
+
+
     /**
      * Returns a reader for the given log file number
      *
@@ -43,8 +45,8 @@ import java.io.FileNotFoundException;
      * @throws FileNotFoundException If the log file can't be found
      */
     LogFileReader getReaderForLogFile( long logFileNumber ) throws IOException, FileNotFoundException;
-    
-  
+
+
     /**
      * Returns a writer for the given log file number
      *
@@ -54,8 +56,8 @@ import java.io.FileNotFoundException;
      * @throws FileNotFoundException If the log file can't be found
      */
     LogFileWriter getWriterForLogFile( long logFileNumber ) throws IOException, FileNotFoundException;
-    
-    
+
+
     /**
      * Create a log file with the given identifier
      * 
@@ -64,8 +66,8 @@ import java.io.FileNotFoundException;
      * @throws IOException If there is an issue creating the LogFile
      */
     boolean createLogFile( long logFileNumber ) throws IOException;
-    
-       
+
+
     /**
      * Truncates the file to the given size. Mostly used for throwing away
      * junk at the end of log file after a log replay after a crash.
@@ -75,16 +77,16 @@ import java.io.FileNotFoundException;
      * @throws IOException If there is an issue truncating the LogFile
      */
     void truncateLogFile( long logFileNumber, long size ) throws IOException;
-    
-    
+
+
     /**
      * Deletes the underlying log file.
      *
      * @param logFileNumber identifier of the log file
      */
-    void deleteLogFile( long logFileNumber ); 
-    
-    
+    void deleteLogFile( long logFileNumber );
+
+
     /**
      * Moves the old log file to a new name
      *
@@ -93,8 +95,7 @@ import java.io.FileNotFoundException;
      * @return true if the rename succeeded
      */
     boolean rename( long orignalLogFileNumber, long newLongFileNumber );
-    
-    
+
     /**
      * An interface defining all the operations a reader can do on a File
      */
@@ -110,7 +111,7 @@ import java.io.FileNotFoundException;
          * @throws EOFException If the file does not contain enough data
          */
         void read( byte[] buffer, int offset, int length ) throws IOException, EOFException;
-        
+
 
         /**
          * Repositions the reader at the given offset
@@ -119,16 +120,16 @@ import java.io.FileNotFoundException;
          * @throws IOException If the seek operation failed
          */
         void seek( long position ) throws IOException;
-        
-        
+
+
         /**
          * Close the log file reader and releases the resources 
          *
          * @throws IOException If the close failed
          */
         void close() throws IOException;
-        
-        
+
+
         /**
          * Each log file is assigned a sequence number. This method
          * returns that number
@@ -136,23 +137,22 @@ import java.io.FileNotFoundException;
          * @return number assigned to this log file
          */
         long logFileNumber();
-        
-        
+
+
         /**
          * @return the length of the file
          * @throws IOException If the operation failed
          */
         long getLength() throws IOException;
-        
-        
+
+
         /**
          * @return the offset of the next read
          * @throws IOException If the operation failed
          */
         long getOffset() throws IOException;
     }
-    
-    
+
     /**
      * An interface defining all the operations a writer can do on a File
      */
@@ -167,24 +167,24 @@ import java.io.FileNotFoundException;
          * @throws IOException If we cannot append data to the file
          */
         void append( byte[] buffer, int offset, int length ) throws IOException;
-        
-        
+
+
         /**
          * Sync the file contents to media
          * 
          * @throws IOException If we cannot sync on disk
          */
         void sync() throws IOException;
-        
-        
+
+
         /**
          * Close the log file reader and releases the resources 
          * 
          * @throws IOException If we cannot close the file
          */
         void close() throws IOException;
-        
-        
+
+
         /**
          * Each log file is assigned a sequence number. This method
          * returns that number
@@ -192,16 +192,16 @@ import java.io.FileNotFoundException;
          * @return number assigned to this log file
          */
         long logFileNumber();
-        
-        
+
+
         /**
          * @return the length of the file
          * 
          * @throws IOException If we cannot return the length
          */
         long getLength() throws IOException;
-        
-        
+
+
         /**
          * Repositions the reader at the given offset.
          *

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileRecords.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileRecords.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileRecords.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFileRecords.java Thu Jan  5 17:28:50 2012
@@ -34,7 +34,7 @@ public class LogFileRecords
      * it easier to scan the log, detect the end of 
      * log during log scan and verify the integrity of log.  
      */
-    
+
     /**
      * Record Header marker
      * int RECORD_HEADER_MAGIC_NUMBER
@@ -42,40 +42,40 @@ public class LogFileRecords
      * long recordLSN     lsn of the log record   
      * long headerChecksum checksum to verify header
      */
-    
+
     /** Header magic number */
     final static int RECORD_HEADER_MAGIC_NUMBER = 0x010F010F;
-     
+
     /** Total header size */
     final static int RECORD_HEADER_SIZE = 24;
-    
+
     /**
      * Record Footer marker 
      * int checksum 
      * int RECORD_FOOTER_MAGIC_NUMBER
      */
-    
+
     /** Footer magic number */
     final static int RECORD_FOOTER_MAGIC_NUMBER = 0x0F010F01;
-   
+
     /** Total header size */
     final static int RECORD_FOOTER_SIZE = 8;
-    
+
     /**
      * LogFileHeader marker
      * long log file number
      * int LOG_FILE_HEADER_MAGIC_NUMBER 0xFF00FF00
      */
-    
+
     /** Log file header marker size */
     final static int LOG_FILE_HEADER_SIZE = 12;
-    
+
     /** Log file header magic number */
     final static int LOG_FILE_HEADER_MAGIC_NUMBER = 0xFF00FF00;
-    
+
     /** Maximum marker size */
     final static int MAX_MARKER_SIZE;
-    
+
     static
     {
         int markerSize = Math.max( RECORD_HEADER_SIZE, RECORD_FOOTER_SIZE );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFlushManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFlushManager.java?rev=1227712&r1=1227711&r2=1227712&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFlushManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogFlushManager.java Thu Jan  5 17:28:50 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.log;
 
+
 import java.nio.ByteBuffer;
 
 import java.util.concurrent.locks.Lock;
@@ -32,12 +33,12 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.core.api.log.InvalidLogException;
 
-
 import java.io.IOException;
 
 import org.apache.directory.server.core.shared.log.LogFileManager.LogFileWriter;
 import org.apache.directory.server.i18n.I18n;
 
+
 /**
  * Manages the flushing of log to media and scanning of logs. All appends to the log file go through this class. 
  *
@@ -47,29 +48,29 @@ import org.apache.directory.server.i18n.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/* Package protected */ class LogFlushManager
+/* Package protected */class LogFlushManager
 {
     /** Ever increasing logical log sequence number assigned to user log records. Bumped up under append lock */
     private long logLSN = Long.MIN_VALUE + 1;
-       
+
     /** Memory buffer size in bytes */
     private final int logBufferSize;
-        
+
     /** Synchronizes appends */
     private final Lock appendLock = new ReentrantLock();
-    
+
     /** Synchronizes flushes to media */
     private final Lock flushLock = new ReentrantLock();
-    
+
     /** Used to wait on ongoing flush */
     private final Condition flushCondition = flushLock.newCondition();
-     
+
     /** In memory LogBuffer */
     private LogBuffer logBuffer;
-    
+
     /** Flush status */
-    private FlushStatus flushStatus = new FlushStatus(); 
-       
+    private FlushStatus flushStatus = new FlushStatus();
+
     /** Current LogFile appends go to */
     private LogFileManager.LogFileWriter currentLogFile;
 
@@ -78,16 +79,17 @@ import org.apache.directory.server.i18n.
 
     /** Size of data appended to the currentLogFile so far */
     private long appendedSize;
-    
+
     /** Sof limit on the log file size */
     private long targetLogFileSize;
-    
+
     /** If logging cannot succeed, then loggingFailed is set to true and further logging is prevented */
     private boolean logFailed;
 
     /** The Checksum used */
     private Checksum checksum = new Adler32();
 
+
     /**
      * Creates a LogFlushManager instance. We define the memory buffer size, and the default maximum
      * size for each Log file (this maximul size may be exceeded, if one user record is bigger than 
@@ -103,15 +105,15 @@ import org.apache.directory.server.i18n.
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_748, logMemoryBufferSize, logFileSize ) );
         }
-        
+
         logBufferSize = logMemoryBufferSize;
         targetLogFileSize = logFileSize;
         this.logManager = logManager;
-        
+
         logBuffer = new LogBuffer( logBufferSize, currentLogFile );
     }
-    
-    
+
+
     /**
      * Appends the given user record to the log. Position where the record is appended is returned as part of
      * userRecord.
@@ -125,21 +127,21 @@ import org.apache.directory.server.i18n.
     {
         boolean appendedRecord = false;
         byte[] userBuffer = userRecord.getDataBuffer();
-        int length  = userRecord.getDataLength();
-        LogAnchor userLogAnchor = userRecord.getLogAnchor(); 
-        
+        int length = userRecord.getDataLength();
+        LogAnchor userLogAnchor = userRecord.getLogAnchor();
+
         int recordSize = LogFileRecords.RECORD_HEADER_SIZE + length + LogFileRecords.RECORD_FOOTER_SIZE;
-        
+
         // The addition of a record is done in a protected section
         appendLock.lock();
-        
+
         // Get out immediately if the log system is invalid
         if ( logFailed )
         {
             appendLock.unlock();
             throw new InvalidLogException( I18n.err( I18n.ERR_750 ) );
         }
-        
+
         // Get a new sequence number for the logged data
         long lsn = logLSN++;
 
@@ -148,7 +150,7 @@ import org.apache.directory.server.i18n.
             // Compute the checksum for the user record
             checksum.reset();
             checksum.update( userBuffer, 0, length );
-            
+
             if ( currentLogFile == null )
             {
                 // We are just starting, get the current log file
@@ -161,76 +163,78 @@ import org.apache.directory.server.i18n.
             if ( appendedSize > targetLogFileSize )
             {
                 // Make sure everything outstanding goes to the current log file
-                flush( lsn, null, 0, 0, true);
-                
+                flush( lsn, null, 0, 0, true );
+
                 currentLogFile = logManager.switchToNextLogFile( currentLogFile );
                 appendedSize = currentLogFile.getLength();
             }
-            
+
             if ( recordSize <= logBufferSize )
             {
                 ByteBuffer writeHead = logBuffer.writeHead;
-                
+
                 while ( !appendedRecord )
                 {
                     // First get the rewind count then the position to which the readhead advanced
                     int readHeadRewindCount = logBuffer.readHeadRewindCount.get();
                     int readHeadPosition = logBuffer.readHeadPosition;
-                    
-                    if ( ( logBuffer.writeHeadRewindCount == readHeadRewindCount ) || 
-                        ( ( logBuffer.writeHeadRewindCount == readHeadRewindCount + 1 ) && 
-                            ( readHeadPosition < writeHead.position() ) ) )
+
+                    if ( ( logBuffer.writeHeadRewindCount == readHeadRewindCount ) ||
+                        ( ( logBuffer.writeHeadRewindCount == readHeadRewindCount + 1 ) &&
+                        ( readHeadPosition < writeHead.position() ) ) )
                     {
                         if ( writeHead.remaining() >= recordSize )
                         {
                             // Write the header
                             writeHeader( writeHead, recordSize, lsn );
-                            
+
                             // Write the data
                             writeHead.put( userBuffer, 0, length );
-                            
+
                             // Write the footeer
-                            writeFooter( writeHead, (int)checksum.getValue() );
-                            
+                            writeFooter( writeHead, ( int ) checksum.getValue() );
+
                             appendedRecord = true;
                         }
-                        else // ( writeHead.remaining() < recordSize )
+                        else
+                        // ( writeHead.remaining() < recordSize )
                         {
                             if ( writeHead.remaining() >= LogFileRecords.RECORD_HEADER_SIZE )
                             {
                                 // Write a skip record
                                 writeHeader( writeHead, -1, -1 );
                             }
-                            
+
                             // rewind buffer now
                             writeHead.rewind();
                             logBuffer.writeHeadRewindCount++;
                         }
                     }
-                    else 
+                    else
                     {
-                        if ( logBuffer.writeHeadRewindCount != ( readHeadRewindCount + 1 )  )
+                        if ( logBuffer.writeHeadRewindCount != ( readHeadRewindCount + 1 ) )
                         {
-                            throw new IllegalStateException( "Unexpected sequence number for read/write heads:" + logBuffer.writeHeadRewindCount +
-                                    " " + readHeadRewindCount );
+                            throw new IllegalStateException( "Unexpected sequence number for read/write heads:"
+                                + logBuffer.writeHeadRewindCount +
+                                " " + readHeadRewindCount );
                         }
-                        
+
                         if ( ( readHeadPosition - writeHead.position() ) > recordSize )
                         {
                             // Write the header
                             writeHeader( writeHead, recordSize, lsn );
-                            
+
                             // Write the data
                             writeHead.put( userBuffer, 0, length );
 
                             // Write the footer
-                            writeFooter( writeHead, (int)checksum.getValue() );
+                            writeFooter( writeHead, ( int ) checksum.getValue() );
 
                             appendedRecord = true;
                         }
                         else
                         {
-                            flush( lsn, null, 0, 0, true);
+                            flush( lsn, null, 0, 0, true );
                         }
                     }
                 }
@@ -239,16 +243,16 @@ import org.apache.directory.server.i18n.
             {
                 flush( lsn, userBuffer, 0, length, true );
             }
-            
+
             userLogAnchor.resetLogAnchor( currentLogFile.logFileNumber(), appendedSize, lsn );
             appendedSize += recordSize;
         }
-        catch( IOException e )
+        catch ( IOException e )
         {
             e.printStackTrace();
             logFailed = true; // Mark log subsytem failed
         }
-        catch( InvalidLogException e )
+        catch ( InvalidLogException e )
         {
             e.printStackTrace();
             logFailed = true; // Mark log subsystem failed
@@ -257,14 +261,14 @@ import org.apache.directory.server.i18n.
         {
             appendLock.unlock();
         }
-        
+
         if ( sync )
-        { 
+        {
             flush( lsn, null, 0, 0, false );
         }
     }
-    
-    
+
+
     /**
      * Syncs the log upto the given lsn. If lsn is equal to unknow lsn, then the log is 
      * flushed upto the latest logged lsn.
@@ -275,23 +279,24 @@ import org.apache.directory.server.i18n.
      */
     void sync( long uptoLSN ) throws IOException, InvalidLogException
     {
-       if ( uptoLSN == LogAnchor.UNKNOWN_LSN )
-       {
-           appendLock.lock();
-           uptoLSN = logLSN - 1;
-           appendLock.unlock();
-       }
-       
-       // If nothing to flush, then just return
-       if ( uptoLSN == LogAnchor.UNKNOWN_LSN )
-       {
-           
-           return;
-       }
-       
-       flush( uptoLSN, null, 0, 0, false );
+        if ( uptoLSN == LogAnchor.UNKNOWN_LSN )
+        {
+            appendLock.lock();
+            uptoLSN = logLSN - 1;
+            appendLock.unlock();
+        }
+
+        // If nothing to flush, then just return
+        if ( uptoLSN == LogAnchor.UNKNOWN_LSN )
+        {
+
+            return;
+        }
+
+        flush( uptoLSN, null, 0, 0, false );
     }
-    
+
+
     /**
      * Flushes the changes in the log buffer upto the given point. The given point is determined as follows:
      * appendLock is held: flushLSN is the highest lsn generated by the logging system and no more appends can
@@ -317,24 +322,24 @@ import org.apache.directory.server.i18n.
      * @throws IOException If we had an issue while flushing some record in the file
      * @throws InvalidLogException If the log system is is declared as invalid, due to a previous error
      */
-    private void flush( long flushLSN, byte[] userBuffer, int offset, int length, 
-                        boolean appendLockHeld ) throws IOException, InvalidLogException
+    private void flush( long flushLSN, byte[] userBuffer, int offset, int length,
+        boolean appendLockHeld ) throws IOException, InvalidLogException
     {
         long uptoLSN = flushLSN;
-       
+
         if ( appendLockHeld == true )
         {
             uptoLSN--;
         }
-        
+
         flushLock.lock();
-        
+
         // Update max requested lsn if necessary
         if ( uptoLSN > flushStatus.uptoLSN )
         {
             flushStatus.uptoLSN = uptoLSN;
         }
-        
+
         /*
          * Check if we need to do flush and wait for ongoing flush if
          * necessary
@@ -346,26 +351,26 @@ import org.apache.directory.server.i18n.
                 flushLock.unlock();
                 throw new InvalidLogException( I18n.err( I18n.ERR_750 ) );
             }
-            
+
             if ( ( flushStatus.flushedLSN >= uptoLSN ) && ( appendLockHeld == false ) )
             {
                 flushLock.unlock();
                 return;
             }
-            
+
             if ( flushStatus.flushInProgress == false )
             {
                 break;
             }
-            
+
             flushStatus.numWaiters++;
             flushCondition.awaitUninterruptibly();
             flushStatus.numWaiters--;
         }
-        
+
         // Mark flush in progress and do the flush
         flushStatus.flushInProgress = true;
-        
+
         // If not appendlock held, adjust uptoLSN with the max one requested by any thread
         if ( appendLockHeld == false )
         {
@@ -375,83 +380,83 @@ import org.apache.directory.server.i18n.
         {
             uptoLSN = flushLSN;
         }
-        
+
         flushLock.unlock();
-        
+
         long flushedLSN = LogAnchor.UNKNOWN_LSN;
-        
+
         try
         {
             flushedLSN = doFlush( uptoLSN, appendLockHeld );
-            
+
             // Now if there is a user buffer, flush from that
             if ( userBuffer != null )
             {
                 ByteBuffer headerFooterHead = logBuffer.headerFooterHead;
                 int recordSize = LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE + length;
-                
+
                 headerFooterHead.rewind();
                 writeHeader( headerFooterHead, recordSize, flushLSN );
                 currentLogFile.append( logBuffer.headerFooterBuffer, 0, LogFileRecords.RECORD_HEADER_SIZE );
-                
-                currentLogFile.append( userBuffer, offset, length );   
-                
+
+                currentLogFile.append( userBuffer, offset, length );
+
                 headerFooterHead.rewind();
-                writeFooter( headerFooterHead, (int)checksum.getValue() );
+                writeFooter( headerFooterHead, ( int ) checksum.getValue() );
                 currentLogFile.append( logBuffer.headerFooterBuffer, 0, LogFileRecords.RECORD_FOOTER_SIZE );
-    
+
                 flushedLSN = flushLSN;
             }
-            
+
             currentLogFile.sync();
         }
-        catch( IOException e )
+        catch ( IOException e )
         {
             // Mark the logger invalid, wakeup any waiters and return
             flushLock.lock();
             logFailed = true;
             flushStatus.flushInProgress = false;
-            
+
             if ( flushStatus.numWaiters != 0 )
             {
                 flushCondition.signalAll();
             }
-            
+
             flushLock.unlock();
-            
+
             throw e;
         }
-        
+
         flushLock.lock();
-        
+
         if ( flushedLSN != LogAnchor.UNKNOWN_LSN )
         {
             flushStatus.flushedLSN = flushedLSN;
-            
+
             if ( flushStatus.flushedLSN > flushStatus.uptoLSN )
             {
                 // This should only happen with append lock held
                 if ( appendLockHeld == false )
                 {
-                    throw new IllegalStateException( "FlushedLSN went ahead of uptoLSN while appendlock is not held: " + 
-                        flushStatus.flushedLSN + "  " + flushStatus.uptoLSN);
+                    throw new IllegalStateException( "FlushedLSN went ahead of uptoLSN while appendlock is not held: " +
+                        flushStatus.flushedLSN + "  " + flushStatus.uptoLSN );
                 }
-                
+
                 flushStatus.uptoLSN = flushStatus.flushedLSN;
             }
         }
-        
+
         flushStatus.flushInProgress = false;
-        
+
         if ( flushStatus.numWaiters != 0 )
         {
             flushCondition.signalAll();
         }
-        
+
         flushLock.unlock();
     }
-    
-    
+
+
     /**
      * Walks the log buffer and writes it to the underlying log file until the uptoLSN or current write head.
      *
@@ -460,21 +465,21 @@ import org.apache.directory.server.i18n.
      * @return lsn upto which flush is done. UNKNOWN_LSN if no flushing is done.
      * @throws IOException
      */
-    private long doFlush( long uptoLSN, boolean appendLockHeld  ) throws IOException
+    private long doFlush( long uptoLSN, boolean appendLockHeld ) throws IOException
     {
         ByteBuffer readHead = logBuffer.readHead;
         ByteBuffer writeHead = logBuffer.writeHead;
         boolean done = false;
-        
+
         int magicNumber;
         int length;
         long lsn = LogAnchor.UNKNOWN_LSN;
-        
+
         while ( !done )
         {
             int totalLength = 0;
-            
-            while( true )
+
+            while ( true )
             {
                 /*
                  * If append lock is held, we might hit write head. We can read
@@ -483,70 +488,70 @@ import org.apache.directory.server.i18n.
                 if ( appendLockHeld )
                 {
                     if ( ( writeHead.position() == readHead.position() ) &&
-                            ( logBuffer.writeHeadRewindCount == logBuffer.readHeadRewindCount.get() ) )
+                        ( logBuffer.writeHeadRewindCount == logBuffer.readHeadRewindCount.get() ) )
                     {
                         done = true;
                         break;
                     }
                 }
-                
+
                 // If less than header length left to process, then break and flush whatever we got so far
                 if ( readHead.remaining() < LogFileRecords.RECORD_HEADER_SIZE )
                 {
                     break;
                 }
-                
+
                 magicNumber = readHead.getInt();
-                
+
                 if ( magicNumber != LogFileRecords.RECORD_HEADER_MAGIC_NUMBER )
                 {
                     throw new IllegalStateException( " Record header magic " +
-                        "number does not match " + magicNumber + " expected "+ 
+                        "number does not match " + magicNumber + " expected " +
                         LogFileRecords.RECORD_HEADER_MAGIC_NUMBER );
                 }
-                
+
                 length = readHead.getInt();
-                
+
                 // Did we hit a skip record at the end of the buffer?
                 if ( length == LogBuffer.SKIP_RECORD_LENGTH )
                 {
                     break;
                 }
-                
+
                 // Sanitize length, it includes header and footer overhead
-                if ( length <= ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE) )
+                if ( length <= ( LogFileRecords.RECORD_HEADER_SIZE + LogFileRecords.RECORD_FOOTER_SIZE ) )
                 {
                     throw new IllegalStateException( "Record length doesnt make sense:" + length + " expected:" +
-                        ( LogFileRecords.RECORD_HEADER_MAGIC_NUMBER + LogFileRecords.RECORD_FOOTER_MAGIC_NUMBER) );
+                        ( LogFileRecords.RECORD_HEADER_MAGIC_NUMBER + LogFileRecords.RECORD_FOOTER_MAGIC_NUMBER ) );
                 }
-                
+
                 // Add to the total length
                 totalLength += length;
-                
+
                 lsn = readHead.getLong();
-                
+
                 // Move to the next record, we processed 16 bytes already
                 readHead.position( readHead.position() + length - 16 );
-                
+
                 if ( lsn >= uptoLSN )
                 {
                     done = true;
                     break;
                 }
             }
-            
+
             // If there is something to flush, then do it now
             if ( totalLength > 0 )
             {
                 int offset;
                 offset = logBuffer.readHeadPosition;
-                
+
                 currentLogFile.append( logBuffer.buffer, offset, totalLength );
-                       
+
                 //move the position to the next record
                 logBuffer.readHeadPosition = readHead.position();
             }
-            
+
             if ( !done )
             {
                 // this means we need to rewind and keep flushing
@@ -555,11 +560,11 @@ import org.apache.directory.server.i18n.
                 logBuffer.readHeadRewindCount.incrementAndGet();
             }
         }
-        
+
         return lsn;
     }
-    
-    
+
+
     /**
      * Write the log file header 
      */
@@ -568,10 +573,10 @@ import org.apache.directory.server.i18n.
         buffer.putInt( LogFileRecords.RECORD_HEADER_MAGIC_NUMBER );
         buffer.putInt( length );
         buffer.putLong( lsn );
-        buffer.putLong( length ^ lsn ); 
+        buffer.putLong( length ^ lsn );
     }
-    
-    
+
+
     /**
      * Write the log file footer 
      */
@@ -580,8 +585,7 @@ import org.apache.directory.server.i18n.
         buffer.putInt( checksum );
         buffer.putInt( LogFileRecords.RECORD_FOOTER_MAGIC_NUMBER );
     }
-    
- 
+
     /**
      * Used to group the memory buffer data together 
      */
@@ -589,31 +593,32 @@ import org.apache.directory.server.i18n.
     {
         /** In memory buffer */
         private byte buffer[];
-        
+
         /** Used to scan the buffer while reading it to flush */
         private ByteBuffer readHead;
-        
+
         /** Advanced as readHead flushes data */
         private int readHeadPosition;
-        
+
         /** Rewind count of readHead. Used to avoid overwriting non flushed data */
         private AtomicInteger readHeadRewindCount;
-        
+
         /** Used to scan the buffer while appending records into it */
         private ByteBuffer writeHead;
-        
+
         /** Rewind count of writeHead. used to avoid overwriting non flushed data */
         private int writeHeadRewindCount;
-        
+
         /** Used to mark records that should be skipped at the end of the log buffer */
         private final static int SKIP_RECORD_LENGTH = -1;
-        
+
         /** Header footer buffer used when writing user buffers directly */
         private byte headerFooterBuffer[];
-        
+
         /** Used to format header footer buffer */
         private ByteBuffer headerFooterHead;
-        
+
+
         /**
          * Create a new instance of a LogBuffer
          */
@@ -621,16 +626,16 @@ import org.apache.directory.server.i18n.
         {
             buffer = new byte[bufferSize];
             readHead = ByteBuffer.wrap( buffer );
-            
+
             readHeadRewindCount = new AtomicInteger( 0 );
-            
+
             writeHead = ByteBuffer.wrap( buffer );
-            
+
             headerFooterBuffer = new byte[LogFileRecords.MAX_MARKER_SIZE];
             headerFooterHead = ByteBuffer.wrap( headerFooterBuffer );
         }
     }
-    
+
     /**
      * Used to group the flush related data together
      */
@@ -638,13 +643,13 @@ import org.apache.directory.server.i18n.
     {
         /** whether flush is going on */
         boolean flushInProgress;
-        
+
         /** Current flush request */
         long uptoLSN = LogAnchor.UNKNOWN_LSN;
-        
+
         /** Current flushed lsn */
         long flushedLSN = LogAnchor.UNKNOWN_LSN;
-        
+
         /** Keeps track of the number of waiters */
         int numWaiters;
     }