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/04/11 07:30:47 UTC

svn commit: r1324565 [2/2] - in /directory/apacheds/branches/index-work: core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/filtering/ core-avl/src/main/java/org/apache/directory/ser...

Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=1324565&r1=1324564&r2=1324565&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java Wed Apr 11 05:30:46 2012
@@ -34,6 +34,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.ExprNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -43,6 +45,9 @@ import org.apache.directory.shared.ldap.
  */
 public class OrCursor<V, ID> extends AbstractIndexCursor<V, Entry, ID>
 {
+    /** A dedicated log for cursors */
+    private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 );
     private final List<IndexCursor<V, Entry, ID>> cursors;
     private final List<Evaluator<? extends ExprNode, Entry, ID>> evaluators;
@@ -54,6 +59,8 @@ public class OrCursor<V, ID> extends Abs
     public OrCursor( List<IndexCursor<V, Entry, ID>> cursors,
         List<Evaluator<? extends ExprNode, Entry, ID>> evaluators )
     {
+        LOG_CURSOR.debug( "Creating OrCursor {}", this );
+        
         if ( cursors.size() <= 1 )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_723 ) );
@@ -63,10 +70,11 @@ public class OrCursor<V, ID> extends Abs
         this.evaluators = evaluators;
         this.blacklists = new ArrayList<Set<ID>>();
 
-        for ( int ii = 0; ii < cursors.size(); ii++ )
+        for ( int i = 0; i < cursors.size(); i++ )
         {
             this.blacklists.add( new HashSet<ID>() );
         }
+        
         this.cursorIndex = 0;
     }
 
@@ -235,10 +243,24 @@ public class OrCursor<V, ID> extends Abs
 
     public void close() throws Exception
     {
+        LOG_CURSOR.debug( "Closing OrCursor {}", this );
         super.close();
+        
         for ( Cursor<?> cursor : cursors )
         {
             cursor.close();
         }
     }
+
+
+    public void close( Exception cause ) throws Exception
+    {
+        LOG_CURSOR.debug( "Closing OrCursor {}", this );
+        super.close( cause );
+        
+        for ( Cursor<?> cursor : cursors )
+        {
+            cursor.close( cause );
+        }
+    }
 }
\ No newline at end of file

Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=1324565&r1=1324564&r2=1324565&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Wed Apr 11 05:30:46 2012
@@ -28,6 +28,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -37,6 +39,9 @@ import org.apache.directory.shared.ldap.
  */
 public class PresenceCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String, Entry, ID>
 {
+    /** A dedicated log for cursors */
+    private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_724 );
     private final IndexCursor<String, Entry, ID> uuidCursor;
     private final IndexCursor<String, Entry, ID> presenceCursor;
@@ -45,6 +50,7 @@ public class PresenceCursor<ID extends C
 
     public PresenceCursor( Store<Entry, ID> store, PresenceEvaluator<ID> presenceEvaluator ) throws Exception
     {
+        LOG_CURSOR.debug( "Creating PresenceCursor {}", this );
         this.presenceEvaluator = presenceEvaluator;
         AttributeType type = presenceEvaluator.getAttributeType();
 
@@ -295,6 +301,7 @@ public class PresenceCursor<ID extends C
 
     public void close() throws Exception
     {
+        LOG_CURSOR.debug( "Closing PresenceCursor {}", this );
         super.close();
 
         if ( presenceCursor != null )
@@ -306,4 +313,20 @@ public class PresenceCursor<ID extends C
             uuidCursor.close();
         }
     }
+
+
+    public void close( Exception cause ) throws Exception
+    {
+        LOG_CURSOR.debug( "Closing PresenceCursor {}", this );
+        super.close( cause );
+
+        if ( presenceCursor != null )
+        {
+            presenceCursor.close( cause );
+        }
+        else
+        {
+            uuidCursor.close( cause );
+        }
+    }
 }

Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1324565&r1=1324564&r2=1324565&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Wed Apr 11 05:30:46 2012
@@ -29,6 +29,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,6 +40,9 @@ import org.apache.directory.shared.ldap.
  */
 public class SubstringCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String, Entry, ID>
 {
+    /** A dedicated log for cursors */
+    private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_725 );
     private final boolean hasIndex;
     private final IndexCursor<String, Entry, ID> wrapped;
@@ -49,6 +54,7 @@ public class SubstringCursor<ID extends 
     public SubstringCursor( Store<Entry, ID> store, final SubstringEvaluator<ID> substringEvaluator )
         throws Exception
     {
+        LOG_CURSOR.debug( "Creating SubstringCursor {}", this );
         evaluator = substringEvaluator;
         hasIndex = store.hasIndexOn( evaluator.getExpression().getAttributeType() );
 
@@ -207,10 +213,26 @@ public class SubstringCursor<ID extends 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void close() throws Exception
     {
+        LOG_CURSOR.debug( "Closing SubstringCursor {}", this );
         super.close();
         wrapped.close();
         clear();
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close( Exception cause ) throws Exception
+    {
+        LOG_CURSOR.debug( "Closing SubstringCursor {}", this );
+        super.close( cause );
+        wrapped.close( cause );
+        clear();
+    }
 }

Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1324565&r1=1324564&r2=1324565&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Wed Apr 11 05:30:46 2012
@@ -28,6 +28,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,6 +40,9 @@ import org.apache.directory.shared.ldap.
  */
 public class SubtreeScopeCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, Entry, ID>
 {
+    /** A dedicated log for cursors */
+    private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
 
     /** The Entry database/store */
@@ -68,6 +73,7 @@ public class SubtreeScopeCursor<ID exten
     public SubtreeScopeCursor( Store<Entry, ID> db, SubtreeScopeEvaluator<Entry, ID> evaluator )
         throws Exception
     {
+        LOG_CURSOR.debug( "Creating SubtreeScopeCursor {}", this );
         this.db = db;
         this.evaluator = evaluator;
 
@@ -312,8 +318,13 @@ public class SubtreeScopeCursor<ID exten
     }
 
 
-    private void closeCursors() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws Exception
     {
+        LOG_CURSOR.debug( "Closing SubtreeScopeCursor {}", this );
+        
         if ( dereferencedCursor != null )
         {
             dereferencedCursor.close();
@@ -323,21 +334,38 @@ public class SubtreeScopeCursor<ID exten
         {
             scopeCursor.close();
         }
-    }
-
+        
+        if ( cursor != null )
+        {
+            cursor.close();
+        }
 
-    @Override
-    public void close() throws Exception
-    {
-        closeCursors();
         super.close();
     }
 
 
-    @Override
+    /**
+     * {@inheritDoc}
+     */
     public void close( Exception cause ) throws Exception
     {
-        closeCursors();
+        LOG_CURSOR.debug( "Closing SubtreeScopeCursor {}", this );
+        
+        if ( dereferencedCursor != null )
+        {
+            dereferencedCursor.close( cause );
+        }
+
+        if ( scopeCursor != null )
+        {
+            scopeCursor.close( cause );
+        }
+        
+        if ( cursor != null )
+        {
+            cursor.close( cause );
+        }
+
         super.close( cause );
     }
 }