|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetscape.ldap.LDAPMessageQueue
netscape.ldap.LDAPSearchListener
Manages search results, references and responses returned on one or more search requests
Field Summary | |
(package private) static long |
serialVersionUID
|
Constructor Summary | |
(package private) |
LDAPSearchListener(boolean asynchOp,
LDAPSearchConstraints cons)
Constructs a LDAP search listener. |
Method Summary | |
(package private) void |
addMessage(LDAPMessage msg)
Queues the LDAP server's response. |
(package private) void |
addRequest(int id,
LDAPConnection connection,
LDAPConnThread connThread,
int timeLimit)
Registers a LDAP request |
(package private) LDAPResponse |
completeRequest()
Wait for request to complete. |
(package private) LDAPResponse |
completeSearchOperation()
Block until all results are in. |
(package private) java.util.Vector |
getAllMessages()
Retrieves all messages currently in the queue without blocking |
(package private) LDAPConnection |
getConnection(int id)
Returns the connection associated with the specified request id |
(package private) LDAPConnThread |
getConnThread(int id)
Returns the connection thread associated with the specified request id |
(package private) java.lang.Long |
getKey()
Get the key of the cache entry. |
int |
getMessageCount()
Returns the count of queued messages |
(package private) int |
getMessageID()
Returns message ID of the last request |
int[] |
getMessageIDs()
Returns message IDs for all outstanding requests |
int |
getRequestCount()
Returns the number of 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. |
(package private) boolean |
isAsynchOp()
Returns a flag whether the listener is used for asynchronous LDAP operations |
(package private) boolean |
isMessageReceived()
Checks if response message is received. |
boolean |
isResponseReceived()
Reports true if a response has been received from the server. |
(package private) void |
merge(LDAPMessageQueue mq2)
Merge two message queues. |
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) int |
removeAllRequests(LDAPConnThread connThread)
Remove all requests associated with the specified connThread Called when a connThread has a network error |
(package private) boolean |
removeRequest(int id)
Remove request with the specified ID Called when a LDAP operation is abandoned (called from LDAPConnThread), or terminated (called by nextMessage() when LDAPResponse message is received) |
(package private) void |
reset()
Resets the state of this object, so it can be recycled. |
(package private) void |
setException(LDAPConnThread connThread,
LDAPException e)
Signals that a network exception occured while servicing the request. |
(package private) void |
setKey(java.lang.Long key)
Set the key of the cache entry. |
java.lang.String |
toString()
String representation of the object |
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 exceptionpublic 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 setKey(java.lang.Long key)
key
- the key of the cache entryjava.lang.Long getKey()
boolean isAsynchOp()
LDAPAsynchronousConnection
LDAPResponse completeRequest() throws LDAPException
LDAPException
- Network error exception
LDAPInterruptedException
- The invoking thread was interruptedvoid merge(LDAPMessageQueue mq2)
mq2
- message queue to merge with this onejava.util.Vector getAllMessages()
void addMessage(LDAPMessage msg)
msg
- response messagevoid setException(LDAPConnThread connThread, LDAPException e)
connThread
- LDAPConnThread on which the exception occurrede
- exceptionboolean isMessageReceived()
public int getMessageCount()
void reset()
LDAPConnection.getResponseListener()
,
netscape.ldap.LDAPConnection#getSearchListener
LDAPConnection getConnection(int id)
id
- request id
LDAPConnThread getConnThread(int id)
id
- request id.
int getMessageID()
void addRequest(int id, LDAPConnection connection, LDAPConnThread connThread, int timeLimit)
id
- LDAP request message IDconnection
- LDAP Connection for the message IDconnThread
- a physical connection to the servertimeLimit
- the maximum number of milliseconds to wait for
the request to completepublic int getRequestCount()
boolean removeRequest(int id)
int removeAllRequests(LDAPConnThread connThread)
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |