org.ldaptive.concurrent
Class QueueingSearchExecutor

java.lang.Object
  extended by org.ldaptive.AbstractRequest
      extended by org.ldaptive.SearchRequest
          extended by org.ldaptive.concurrent.AbstractSearchExecutor
              extended by org.ldaptive.concurrent.QueueingSearchExecutor
All Implemented Interfaces:
Message<RequestControl>, Request

public class QueueingSearchExecutor
extends AbstractSearchExecutor

Executes a search filter and places the results of the operation on a blocking queue. The capacity of the queue can be configured to address memory concerns related to large result sets.

Version:
$Revision: 3120 $ $Date: 2015-10-01 11:50:02 -0400 (Thu, 01 Oct 2015) $
Author:
Middleware Services

Nested Class Summary
protected  class QueueingSearchExecutor.AbstractHandler
          Common implementation for the handler classes.
protected  class QueueingSearchExecutor.IntermediateResponseHandler
          Places intermediate responses on a blocking queue.
protected  class QueueingSearchExecutor.SearchEntryHandler
          Places search entries on a blocking queue.
static class QueueingSearchExecutor.SearchItem
          Contains data returned when using the QueueingSearchExecutor.
protected  class QueueingSearchExecutor.SearchReferenceHandler
          Places search references on a blocking queue.
 
Field Summary
 
Fields inherited from class org.ldaptive.concurrent.AbstractSearchExecutor
logger
 
Constructor Summary
QueueingSearchExecutor()
          Default constructor.
QueueingSearchExecutor(ExecutorService es)
          Creates a new blocking search executor.
QueueingSearchExecutor(int capacity)
          Creates a new blocking search executor.
QueueingSearchExecutor(int capacity, ExecutorService es)
          Creates a new blocking search executor.
 
Method Summary
protected  void configureSearchRequest(SearchRequest request, BlockingQueue<QueueingSearchExecutor.SearchItem> queue)
          Sets the appropriate handlers on the supplied search request so that entries, references, and intermediate responses are made available on the supplied queue.
protected  Callable<Response<SearchResult>> createCallable(Connection conn, SearchOperation operation, SearchRequest request, BlockingQueue<QueueingSearchExecutor.SearchItem> queue)
          Returns a Callable that executes the supplied request with the supplied operation in a try-finally block that opens and closes the connection.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory)
          Performs a search operation with the supplied connection factory.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory, SearchFilter filter)
          Performs a search operation with the supplied connection factory.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory, SearchFilter filter, String... attrs)
          Performs a search operation with the supplied connection factory.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory, SearchFilter filter, String[] attrs, SearchEntryHandler... handlers)
          Performs a search operation with the supplied connection factory.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory, String filter)
          Performs a search operation with the supplied connection factory.
 BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory, String filter, String... attrs)
          Performs a search operation with the supplied connection factory.
 
Methods inherited from class org.ldaptive.concurrent.AbstractSearchExecutor
createSearchOperation, finalize, getExecutorService, getSearchCache, getSearchExceptionHandler, getSearchResponseHandlers, setSearchCache, setSearchExceptionHandler, setSearchResponseHandlers, shutdown, shutdownNow, toString
 
Methods inherited from class org.ldaptive.SearchRequest
equals, getBaseDn, getBinaryAttributes, getDerefAliases, getReturnAttributes, getSearchEntryHandlers, getSearchFilter, getSearchReferenceHandlers, getSearchScope, getSizeLimit, getSortBehavior, getTimeLimit, getTimeLimitDuration, getTypesOnly, hashCode, newObjectScopeSearchRequest, newObjectScopeSearchRequest, newObjectScopeSearchRequest, newSearchRequest, setBaseDn, setBinaryAttributes, setDerefAliases, setReturnAttributes, setSearchEntryHandlers, setSearchFilter, setSearchReferenceHandlers, setSearchScope, setSizeLimit, setSortBehavior, setTimeLimit, setTimeLimitDuration, setTypesOnly
 
Methods inherited from class org.ldaptive.AbstractRequest
getControls, getFollowReferrals, getIntermediateResponseHandlers, setControls, setFollowReferrals, setIntermediateResponseHandlers
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueueingSearchExecutor

public QueueingSearchExecutor()
Default constructor.


QueueingSearchExecutor

public QueueingSearchExecutor(int capacity)
Creates a new blocking search executor.

Parameters:
capacity - of the blocking queue returned from search operations

QueueingSearchExecutor

public QueueingSearchExecutor(ExecutorService es)
Creates a new blocking search executor.

Parameters:
es - executor service

QueueingSearchExecutor

public QueueingSearchExecutor(int capacity,
                              ExecutorService es)
Creates a new blocking search executor.

Parameters:
capacity - of the blocking queue returned from search operations
es - executor service
Method Detail

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory,
                                                               String filter)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
filter - to search with
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory,
                                                               SearchFilter filter)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
filter - to search with
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory,
                                                               String filter,
                                                               String... attrs)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
filter - to search with
attrs - to return
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory,
                                                               SearchFilter filter,
                                                               String... attrs)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
filter - to search with
attrs - to return
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

search

public BlockingQueue<QueueingSearchExecutor.SearchItem> search(ConnectionFactory factory,
                                                               SearchFilter filter,
                                                               String[] attrs,
                                                               SearchEntryHandler... handlers)
                                                        throws LdapException
Performs a search operation with the supplied connection factory.

Parameters:
factory - to get a connection from
filter - to search with
attrs - to return
handlers - entry handlers
Returns:
blocking queue to receive search items
Throws:
LdapException - if the connection factory cannot create a connection

createCallable

protected Callable<Response<SearchResult>> createCallable(Connection conn,
                                                          SearchOperation operation,
                                                          SearchRequest request,
                                                          BlockingQueue<QueueingSearchExecutor.SearchItem> queue)
Returns a Callable that executes the supplied request with the supplied operation in a try-finally block that opens and closes the connection.

Parameters:
conn - connection that the operation will execute on
operation - to execute
request - to pass to the operation
queue - to put search items on
Returns:
callable for the supplied operation and request

configureSearchRequest

protected void configureSearchRequest(SearchRequest request,
                                      BlockingQueue<QueueingSearchExecutor.SearchItem> queue)
Sets the appropriate handlers on the supplied search request so that entries, references, and intermediate responses are made available on the supplied queue.

Parameters:
request - search request to modify
queue - to use in the handlers


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.