directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <kayyag...@apache.org>
Subject Re: doSyncSearch recursive code
Date Mon, 03 Dec 2012 02:23:52 GMT
On Mon, Dec 3, 2012 at 5:30 AM, Emmanuel Lécharny <elecharny@gmail.com>wrote:

> Hi !
>
> I wonder why we do something like :
>
> private void doSyncSearch( SynchronizationModeEnum syncType, boolean
> reloadHint ) throws Exception
> {
>     ...
>     SearchFuture sf = connection.searchAsync( searchRequest );
>     ...
>     while ( !( resp instanceof SearchResultDone ) && !sf.isCancelled()
> && !disconnected )
>     {
>         ...
>     }
>
>     ...
>     if ( resultCode == ResultCodeEnum.E_SYNC_REFRESH_REQUIRED )
>     {
>         ...
>         doSyncSearch( syncType, true );
>     }
> }
>
> I understand that if we get a E_SYNC_REFRESH_REQUIRED result, then we
> must void the cookie, delete all the entries we locally have under the
> baseDN and redo a sync search, but here, we are at risk of calling the
> method over and over...
>
> Can't we use an encapsulating while() ?
>
you mean using the existing while() loop for handling the
E_SYNC_REFRESH_REQUIRED  ?
there won't be an infinite loop unless server keep sending the
E_SYNC_REFRESH_REQUIRED error
on each try.

>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>


-- 
Kiran Ayyagari
http://keydap.com

Mime
View raw message