directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Sync/Asyc operations
Date Wed, 10 Feb 2010 23:17:08 GMT
Hi,

a quick mail about operations, as we talked about some aspect of it with 
Ludovic a couple of time, and we need to have some track of those 
discussions.

So we agreed that each operation should be synchronous *and* 
asynchronous. Having async operation is of major importance for 
operation that one user wants to abandon. Something like :

Future responseFuture = connection.search( blah );
int i = 0;

while ( responseFuture.hasMore() )
{
   Response response = responseFuture.get();
   i++;
   ...

   if ( i > 10 )
   {
     // Ok, enough
     responseFuture.abandon();
     break;
   }
}

is easier to use than having to declare a new thread to abandon a request.

There are some huge differences between OpenDS, UID and ADS in this area :
- ODS has two LdapConnection objects : one for sync operations, one for 
async operations.
- UID has two methods for each operation. For instance bind() and 
asyncBind()
- ADS has a bit more complicated system which implise that a listener to 
be injected in the method to make it async : bind( bindReques, listener) 
=> async. bind( bindRequest ) => sync.

I think that UID approach is the most user friendly. Most of the case, 
users will use the sync methods. I don't like having 2 LdapConnection 
object, as it forbids the user to switch from sync to async. The ADS 
approach, based on listener, is way too complex.

thoughts ?

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.nextury.com



Mime
View raw message