use of org.apache.directory.ldap.client.api.exception.LdapConnectionTimeOutException in project directory-ldap-api by apache.
the class SearchCursorImpl method next.
/**
* {@inheritDoc}
*/
@Override
public boolean next() throws LdapException, CursorException {
if (done) {
return false;
}
try {
if (future.isCancelled()) {
response = null;
done = true;
return false;
}
response = future.get(timeout, timeUnit);
} catch (Exception e) {
LdapException ldapException = new LdapException(LdapNetworkConnection.NO_RESPONSE_ERROR, e);
// Send an abandon request
if (!future.isCancelled()) {
future.cancel(true);
}
// close the cursor
try {
close(ldapException);
} catch (IOException ioe) {
throw new LdapException(ioe.getMessage(), ioe);
}
throw ldapException;
}
if (response == null) {
future.cancel(true);
throw new LdapConnectionTimeOutException(LdapNetworkConnection.TIME_OUT_ERROR);
}
done = response instanceof SearchResultDone;
if (done) {
searchDoneResp = (SearchResultDone) response;
response = null;
}
return !done;
}
Aggregations