Package org.ldaptive.async
Class AsyncSearchOperation
- java.lang.Object
-
- org.ldaptive.AbstractOperation<Q,S>
-
- org.ldaptive.async.AbstractAsyncOperation<SearchRequest,SearchResult>
-
- org.ldaptive.async.AsyncSearchOperation
-
- All Implemented Interfaces:
Operation<SearchRequest,SearchResult>
public class AsyncSearchOperation extends AbstractAsyncOperation<SearchRequest,SearchResult>
Executes an asynchronous ldap search operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AsyncSearchOperation.AsyncSearchListener
Async search listener used to build a search result and invoke search request handlers.-
Nested classes/interfaces inherited from class org.ldaptive.AbstractOperation
AbstractOperation.ReopenOperationExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private ExecutorService
executorService
Cached thread executor to submit async operations to.private boolean
useMultiThreadedListener
Whether the listener should spawn a new thread to process each result.-
Fields inherited from class org.ldaptive.AbstractOperation
logger
-
-
Constructor Summary
Constructors Constructor Description AsyncSearchOperation(Connection conn)
Creates a new async search operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FutureResponse<SearchResult>
execute(SearchRequest request)
Execute this ldap operation.protected void
finalize()
boolean
getUseMultiThreadedListener()
Returns whether the listener should spawn a new thread to process each result.protected Response<SearchResult>
invoke(SearchRequest request)
Call the provider specific implementation of this ldap operation.void
setUseMultiThreadedListener(boolean b)
Sets whether the listener should spawn a new thread to process each result.void
shutdown()
InvokesExecutorService.shutdown()
on the underlying executor service.-
Methods inherited from class org.ldaptive.async.AbstractAsyncOperation
getAsyncRequestHandlers, getExceptionHandler, setAsyncRequestHandlers, setExceptionHandler
-
Methods inherited from class org.ldaptive.AbstractOperation
executeHandlers, getConnection, getOperationExceptionHandler, getOperationResponseHandlers, setOperationExceptionHandler, setOperationResponseHandlers, toString
-
-
-
-
Field Detail
-
executorService
private final ExecutorService executorService
Cached thread executor to submit async operations to.
-
useMultiThreadedListener
private boolean useMultiThreadedListener
Whether the listener should spawn a new thread to process each result.
-
-
Constructor Detail
-
AsyncSearchOperation
public AsyncSearchOperation(Connection conn)
Creates a new async search operation.- Parameters:
conn
- connection
-
-
Method Detail
-
getUseMultiThreadedListener
public boolean getUseMultiThreadedListener()
Returns whether the listener should spawn a new thread to process each result.- Returns:
- whether the listener is multi-threaded
-
setUseMultiThreadedListener
public void setUseMultiThreadedListener(boolean b)
Sets whether the listener should spawn a new thread to process each result.- Parameters:
b
- make the listener multi-threaded
-
execute
public FutureResponse<SearchResult> execute(SearchRequest request) throws LdapException
Description copied from interface:Operation
Execute this ldap operation.- Specified by:
execute
in interfaceOperation<SearchRequest,SearchResult>
- Overrides:
execute
in classAbstractOperation<SearchRequest,SearchResult>
- Parameters:
request
- containing the data required by this operation- Returns:
- response for this operation
- Throws:
LdapException
- if the operation fails
-
invoke
protected Response<SearchResult> invoke(SearchRequest request) throws LdapException
Description copied from class:AbstractOperation
Call the provider specific implementation of this ldap operation.- Specified by:
invoke
in classAbstractOperation<SearchRequest,SearchResult>
- Parameters:
request
- ldap request- Returns:
- ldap response
- Throws:
LdapException
- if the invocation fails
-
shutdown
public void shutdown()
InvokesExecutorService.shutdown()
on the underlying executor service.
-
-