Class LDAPSearchListener
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LDAPSearchConstraints
private Long
(package private) static final long
-
Constructor Summary
ConstructorsConstructorDescriptionLDAPSearchListener
(boolean asynchOp, LDAPSearchConstraints cons) Constructs a LDAP search listener. -
Method Summary
Modifier and TypeMethodDescription(package private) LDAPResponse
Block until all results are in.(package private) Long
getKey()
Get the key of the cache entry.int[]
Returns message IDs for all outstanding requestsBlocks until a search result, reference or response is available, or until all operations associated with the object have completed or been canceled.(package private) LDAPSearchConstraints
Return the search constraints used to create this object.boolean
Reports true if a response has been received from the server.void
merge
(LDAPSearchListener listener2) Merge two response listeners.(package private) LDAPMessage
Override nextMessage to wake up the LDAPConnThread if backlog limit has been reached(package private) void
reset()
Resets the state of this object, so it can be recycled.(package private) void
Set the key of the cache entry.(package private) void
Set new search constraints object.Methods inherited from class netscape.ldap.LDAPMessageQueue
addMessage, addRequest, completeRequest, getAllMessages, getConnection, getConnThread, getMessageCount, getMessageID, getRequestCount, isAsynchOp, isMessageReceived, merge, removeAllRequests, removeRequest, setException, toString, waitFirstMessage
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
m_key
-
m_constraints
-
-
Constructor Details
-
LDAPSearchListener
LDAPSearchListener(boolean asynchOp, LDAPSearchConstraints cons) Constructs a LDAP search listener.- Parameters:
asynchOp
- a boolean flag indicating whether the object is used for asynchronous LDAP operationscons
- LDAP search constraints- See Also:
-
-
Method Details
-
completeSearchOperation
Block until all results are in. Used for synchronous search with batch size of zero.- Returns:
- search response message.
-
getResponse
Blocks until a search result, reference or response is available, or until all operations associated with the object have completed or been canceled.- Returns:
- a search result, search reference, search response message, or null if there are no more outstanding requests.
- Throws:
LDAPException
- Network error exceptionLDAPInterruptedException
- The invoking thread was interrupted- See Also:
-
nextMessage
Override nextMessage to wake up the LDAPConnThread if backlog limit has been reached- Overrides:
nextMessage
in classLDAPMessageQueue
- Returns:
- LDAP message or null if there are no more outstanding requests.
- Throws:
LDAPException
- Network error exception
-
merge
Merge two response listeners. Move/append the content from another response listener to this one.To be used for synchronization of asynchronous LDAP operations where requests are sent by one thread but processed by another one.
A client may be implemented in such a way that one thread makes LDAP requests and calls l.getMessageIDs(), while another thread is responsible for processing of responses (call l.getResponse()). Both threads are using the same listener objects. In such a case, a race condition may occur, where a LDAP response message is retrieved and the request terminated (request ID removed) before the first thread has a chance to execute l.getMessageIDs(). The proper way to handle this scenario is to create a separate listener for each new request, and after l.getMessageIDs() has been invoked, merge the new request with the existing one.
- Parameters:
listener2
- the listener with which to merge
-
isResponseReceived
public boolean isResponseReceived()Reports true if a response has been received from the server.- Returns:
- a flag indicating whether the response message queue is empty.
-
getMessageIDs
public int[] getMessageIDs()Returns message IDs for all outstanding requests- Overrides:
getMessageIDs
in classLDAPMessageQueue
- Returns:
- message ID array.
-
getSearchConstraints
LDAPSearchConstraints getSearchConstraints()Return the search constraints used to create this object.- Returns:
- the search constraints used to create this object.
-
setSearchConstraints
Set new search constraints object.- Parameters:
cons
- LDAP search constraints
-
reset
void reset()Resets the state of this object, so it can be recycled. Used by LDAPConnection synchronous operations.- Overrides:
reset
in classLDAPMessageQueue
- See Also:
-
setKey
Set the key of the cache entry. The listener needs to know this value when the results get processed in the queue. After the results have been saved in the vector, then the key and a vector of results are put in the cache.- Parameters:
key
- the key of the cache entry
-
getKey
Long getKey()Get the key of the cache entry.- Returns:
- the key of the cache entry.
-