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 08:55:59 UTC
svn commit: r1324591 - in /directory/shared/trunk/ldap:
client/api/src/main/java/org/apache/directory/ldap/client/api/
model/src/main/java/org/apache/directory/shared/ldap/model/cursor/
Author: elecharny
Date: Wed Apr 11 06:55:58 2012
New Revision: 1324591
URL: http://svn.apache.org/viewvc?rev=1324591&view=rev
Log:
o Added a dedicated logger for all the cursor open/close operations
o Traced all the openings and closings of cursors
Modified:
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java?rev=1324591&r1=1324590&r2=1324591&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java Wed Apr 11 06:55:58 2012
@@ -31,6 +31,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.Response;
import org.apache.directory.shared.ldap.model.message.SearchResultDone;
import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -42,6 +44,9 @@ import org.apache.directory.shared.ldap.
*/
public class EntryCursorImpl extends AbstractCursor<Entry> implements EntryCursor
{
+ /** A dedicated log for cursors */
+ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
/** a reference to hold the retrieved SearchResponse object from SearchFuture */
private Response response;
@@ -59,6 +64,7 @@ public class EntryCursorImpl extends Abs
*/
public EntryCursorImpl( SearchCursor searchCursor )
{
+ LOG_CURSOR.debug( "Creating EntryCursorImpl {}", this );
this.searchCursor = searchCursor;
messageId = -1;
}
@@ -157,6 +163,7 @@ public class EntryCursorImpl extends Abs
@Override
public void close() throws Exception
{
+ LOG_CURSOR.debug( "Closing EntryCursorImpl {}", this );
searchCursor.close();
}
@@ -167,6 +174,7 @@ public class EntryCursorImpl extends Abs
@Override
public void close( Exception cause ) throws Exception
{
+ LOG_CURSOR.debug( "Closing EntryCursorImpl {}", this );
searchCursor.close( cause );
}
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java?rev=1324591&r1=1324590&r2=1324591&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java Wed Apr 11 06:55:58 2012
@@ -36,6 +36,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.SearchResultDone;
import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
import org.apache.directory.shared.ldap.model.message.SearchResultReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -47,6 +49,9 @@ import org.apache.directory.shared.ldap.
*/
public class SearchCursorImpl extends AbstractCursor<Response> implements SearchCursor
{
+ /** A dedicated log for cursors */
+ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
/** the search future */
private SearchFuture future;
@@ -75,6 +80,7 @@ public class SearchCursorImpl extends Ab
*/
public SearchCursorImpl( SearchFuture future, long timeout, TimeUnit timeUnit )
{
+ LOG_CURSOR.debug( "Creating SearchCursorImpl {}", this );
this.future = future;
this.timeout = timeout;
this.timeUnit = timeUnit;
@@ -175,6 +181,7 @@ public class SearchCursorImpl extends Ab
@Override
public void close() throws Exception
{
+ LOG_CURSOR.debug( "Closing SearchCursorImpl {}", this );
close( null );
}
@@ -185,6 +192,8 @@ public class SearchCursorImpl extends Ab
@Override
public void close( Exception cause ) throws Exception
{
+ LOG_CURSOR.debug( "Closing SearchCursorImpl {}", this );
+
if ( done )
{
super.close();
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java?rev=1324591&r1=1324590&r2=1324591&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java Wed Apr 11 06:55:58 2012
@@ -20,6 +20,8 @@ package org.apache.directory.shared.ldap
import org.apache.directory.shared.i18n.I18n;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -30,6 +32,14 @@ import org.apache.directory.shared.i18n.
*/
public class EmptyCursor<E> extends AbstractCursor<E>
{
+ /** A dedicated log for cursors */
+ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
+ public EmptyCursor()
+ {
+ LOG_CURSOR.debug( "Creating EmptyCursor : {}", this );
+ }
+
/**
* {@inheritDoc}
*/
@@ -123,4 +133,26 @@ public class EmptyCursor<E> extends Abst
checkNotClosed( "get()" );
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_02004_EMPTY_CURSOR ) );
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws Exception
+ {
+ LOG_CURSOR.debug( "Closing EmptyCursor {}", this );
+ super.close();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close( Exception cause ) throws Exception
+ {
+ LOG_CURSOR.debug( "Closing EmptyCursor {}", this );
+ super.close( cause );
+ }
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java?rev=1324591&r1=1324590&r2=1324591&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java Wed Apr 11 06:55:58 2012
@@ -25,6 +25,8 @@ import java.util.Comparator;
import java.util.List;
import org.apache.directory.shared.i18n.I18n;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -36,6 +38,9 @@ import org.apache.directory.shared.i18n.
*/
public class ListCursor<E> extends AbstractCursor<E>
{
+ /** A dedicated log for cursors */
+ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
/** The inner List */
private final List<E> list;
@@ -47,8 +52,8 @@ public class ListCursor<E> extends Abstr
/** The ending position for the cursor in the list. It can be < List.size() */
private final int end;
-
/** The current position in the list */
+
private int index = -1;
@@ -89,6 +94,7 @@ public class ListCursor<E> extends Abstr
throw new IllegalArgumentException( I18n.err( I18n.ERR_02007_START_INDEX_ABOVE_END_INDEX, start, end ) );
}
+ LOG_CURSOR.debug( "Creating ListCursor {}", this );
this.comparator = comparator;
this.list = list;
this.start = start;
@@ -489,4 +495,26 @@ public class ListCursor<E> extends Abstr
return list.get( index );
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws Exception
+ {
+ LOG_CURSOR.debug( "Closing ListCursor {}", this );
+ super.close();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close( Exception cause ) throws Exception
+ {
+ LOG_CURSOR.debug( "Closing ListCursor {}", this );
+ super.close( cause );
+ }
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java?rev=1324591&r1=1324590&r2=1324591&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java Wed Apr 11 06:55:58 2012
@@ -22,6 +22,8 @@ package org.apache.directory.shared.ldap
import java.util.Comparator;
import org.apache.directory.shared.i18n.I18n;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -32,6 +34,9 @@ import org.apache.directory.shared.i18n.
*/
public class SingletonCursor<E> extends AbstractCursor<E>
{
+ /** A dedicated log for cursors */
+ private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
+
/** A flag to tell if the cursor is set before the first element */
private boolean beforeFirst = true;
@@ -68,6 +73,7 @@ public class SingletonCursor<E> extends
*/
public SingletonCursor( E singleton, Comparator<E> comparator )
{
+ LOG_CURSOR.debug( "Creating SingletonCursor {}", this );
this.singleton = singleton;
this.comparator = comparator;
}
@@ -313,4 +319,26 @@ public class SingletonCursor<E> extends
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_02013_CANNOT_ACCESS_IF_AFTER_LAST ) );
}
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws Exception
+ {
+ LOG_CURSOR.debug( "Closing SingletonCursor {}", this );
+ super.close();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close( Exception cause ) throws Exception
+ {
+ LOG_CURSOR.debug( "Closing SingletonCursor {}", this );
+ super.close( cause );
+ }
}