|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetscape.ldap.LDAPMessageQueue
netscape.ldap.LDAPResponseListener
Represents the message queue associated with a particular LDAP operation or operations.
Field Summary | |
(package private) static long |
serialVersionUID
|
Constructor Summary | |
(package private) |
LDAPResponseListener(boolean asynchOp)
Constructor |
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) 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 |
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. |
LDAPResponse |
getResponse()
Blocks until a response is available, or until all operations associated with the object have completed or been canceled, and returns the response. |
(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(LDAPResponseListener listener2)
Merge two response listeners. |
(package private) LDAPMessage |
nextMessage()
Blocks until a response is available or until all operations associated with the object have completed or been canceled. |
(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. |
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 |
LDAPResponseListener(boolean asynchOp)
asynchOp
- a boolean flag that is true if the object is used for
asynchronous LDAP operationsLDAPAsynchronousConnection
Method Detail |
public LDAPResponse getResponse() throws LDAPException
LDAPException
- Network error exception
LDAPInterruptedException
- The invoking thread was interruptedpublic void merge(LDAPResponseListener 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
boolean isAsynchOp()
LDAPAsynchronousConnection
LDAPMessage nextMessage() throws LDAPException
LDAPException
- Network error exception
LDAPInterruptedException
- The invoking thread was interruptedLDAPResponse 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 |