Package org.forgerock.opendj.server.core
Class ResponseStream
java.lang.Object
org.forgerock.opendj.server.core.ResponseStream
A stream of LDAP response messages.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseStreamconcat(List<ResponseStream> streams) Returns a response stream containing all of the responses in list of streams, in order.concatWith(ResponseStream other) Returns a response stream containing all of the responses in this stream followed by all of the responses in the other stream.Returns a response stream which contains only the responses which match the provided predicate.voidPerforms an action for each response in this stream blocking until there are no more responses or aResulthas been observed.Returns a response stream containing responses transformed by the provided mapping function.mapOptional(Function<Response, Response> mapper) Returns a response stream whose responses have been mapped or filtered by the provided optional mapping function.next()Returns the next response, waiting if necessary until one becomes available, or returnsnullif no more responses are expected.static ResponseStreamof()Returns an empty response stream.static ResponseStreamReturns a response stream containing a single response.static ResponseStreamReturns a response stream containing an LDAP error obtained from the providedThrowable.static ResponseStreamofIterator(Iterator<? extends Response> responses) Returns a response stream containing a sequence of responses.static ResponseStreamReturns a response stream containing a list of responses.static ResponseStreamofQueue(BlockingQueue<? extends Response> queue) Returns a response stream that will poll responses from the provided blocking queue.tryNext()Returns the next response if it can be obtained without blocking, otherwisenull.
-
Method Details
-
of
Returns an empty response stream.- Returns:
- An empty response stream.
-
of
Returns a response stream containing a single response.- Parameters:
response- The single response.- Returns:
- A response stream containing a single response.
-
ofList
Returns a response stream containing a list of responses.- Parameters:
responses- The responses.- Returns:
- A response stream containing a list of responses.
-
ofIterator
Returns a response stream containing a sequence of responses.- Parameters:
responses- The responses.- Returns:
- A response stream containing a sequence of responses.
-
ofQueue
Returns a response stream that will poll responses from the provided blocking queue. Callingnext()will block indefinitely until a response is available. If the thread is interrupted then the method will continue to wait and re-interrupt the current thread when it finally has a response.- Parameters:
queue- The queue of responses.- Returns:
- A response stream that will poll responses from the provided blocking queue.
-
ofError
Returns a response stream containing an LDAP error obtained from the providedThrowable.- Parameters:
t- The error.- Returns:
- A response stream containing an LDAP error.
-
concat
Returns a response stream containing all of the responses in list of streams, in order.- Parameters:
streams- The list of response streams.- Returns:
- The concatenated response stream.
-
filter
Returns a response stream which contains only the responses which match the provided predicate.- Parameters:
predicate- The predicate.- Returns:
- A filtered response stream.
-
map
Returns a response stream containing responses transformed by the provided mapping function.- Parameters:
mapper- The mapping function.- Returns:
- A transformed response stream.
-
mapOptional
Returns a response stream whose responses have been mapped or filtered by the provided optional mapping function. The functional should return {code null} to indicate that the response should be filtered.- Parameters:
mapper- The mapping function, which should return {code null} to indicate that the response should be filtered.- Returns:
- A transformed and filtered response stream.
-
concatWith
Returns a response stream containing all of the responses in this stream followed by all of the responses in the other stream.- Parameters:
other- The response streams to be appended to this response stream.- Returns:
- The concatenated response stream.
-
tryNext
Returns the next response if it can be obtained without blocking, otherwisenull.- Returns:
- The next response, or
nullif there are no responses available.
-
next
Returns the next response, waiting if necessary until one becomes available, or returnsnullif no more responses are expected.- Returns:
- The next response, or returns
nullif no more responses are expected.
-
forEach
Performs an action for each response in this stream blocking until there are no more responses or aResulthas been observed.- Parameters:
action- An action to perform on each response.
-