|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetscape.ldap.LDAPMessageQueue
netscape.ldap.LDAPSearchListener
public class LDAPSearchListener
Manages search results, references and responses returned on one or more search requests
Field Summary | |
---|---|
(package private) static long |
serialVersionUID
|
Constructor Summary | |
---|---|
LDAPSearchListener(boolean asynchOp,
LDAPSearchConstraints cons)
Constructs a LDAP search listener. |
Method Summary | |
---|---|
(package private) LDAPResponse |
completeSearchOperation()
Block until all results are in. |
(package private) java.lang.Long |
getKey()
Get the key of the cache entry. |
int[] |
getMessageIDs()
Returns message IDs for all outstanding requests |
LDAPMessage |
getResponse()
Blocks 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 |
getSearchConstraints()
Return the search constraints used to create this object. |
boolean |
isResponseReceived()
Reports true if a response has been received from the server. |
void |
merge(LDAPSearchListener listener2)
Merge two response listeners. |
(package private) LDAPMessage |
nextMessage()
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 |
setKey(java.lang.Long key)
Set the key of the cache entry. |
(package private) void |
setSearchConstraints(LDAPSearchConstraints cons)
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
Constructor Detail |
---|
LDAPSearchListener(boolean asynchOp, LDAPSearchConstraints cons)
asynchOp
- a boolean flag indicating whether the object is used
for asynchronous LDAP operationscons
- LDAP search constraintsLDAPAsynchronousConnection
Method Detail |
---|
LDAPResponse completeSearchOperation() throws LDAPException
Network
- exception error
LDAPException
public LDAPMessage getResponse() throws LDAPException
LDAPException
- Network error exception
LDAPInterruptedException
- The invoking thread was interruptedLDAPResponse
,
LDAPSearchResult
,
LDAPSearchResultReference
LDAPMessage nextMessage() throws LDAPException
nextMessage
in class LDAPMessageQueue
LDAPException
- Network error exception
LDAPInterruptedException
- The invoking thread was interruptedpublic void merge(LDAPSearchListener listener2)
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.
listener2
- the listener with which to mergepublic boolean isResponseReceived()
public int[] getMessageIDs()
getMessageIDs
in class LDAPMessageQueue
LDAPSearchConstraints getSearchConstraints()
void setSearchConstraints(LDAPSearchConstraints cons)
cons
- LDAP search constraintsvoid reset()
reset
in class LDAPMessageQueue
LDAPConnection.getResponseListener()
,
LDAPConnection.getSearchListener(netscape.ldap.LDAPSearchConstraints)
void setKey(java.lang.Long key)
key
- the key of the cache entryjava.lang.Long getKey()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |