Enumerates the communication endpoints represented by this
ServerEndpoint by passing the
ListenEndpoint for each of them to
listenContext, which will ensure an active listen operation on each endpoint, and returns an
Endpoint instance corresponding to the listen operations chosen by
listenContext.
This method uses listenContext to cooperate with the caller to ensure the appropriate listen operations. In this cooperation,
- the
ServerEndpoint is responsible for declaring to the caller the discrete communication endpoints represented by this ServerEndpoint as ListenEndpoint instances passed to listenContext's {@link ListenContext#addListenEndpoint addListenEndpoint} method, and - the caller is responsible for declaring the active listen operations to be used for this
ServerEndpoint.enumerateListenEndpoints invocation corresponding to each discrete communication endpoint as {@link ListenCookie ListenCookie} instances returned fromlistenContext's addListenEndpoint method.
For each
ListenEndpoint, the caller (through
listenContext) may choose to start a new listen operation, or it may choose to reuse a previously started listen operation that it has a
ListenCookie for.
This method sequentially invokes addListenEndpoint on listenContext once for each discrete communication endpoint represented by this ServerEndpoint, passing the ListenEndpoint representing that communication endpoint. If any of the invocations of ListenContext.addListenEndpoint throws an exception, this method throws that exception. Otherwise, this method returns an Endpoint instance that sends requests to be received by the listen operations chosen by listenContext.
@param listenContext the ListenContext to passthis ServerEndpoint's ListenEndpoint instances to
@return the Endpoint instance for sending requeststo this ServerEndpoint's communication endpoints being listened on
@throws IOException if an I/O exception occurs while attemptingto listen for requests on the communication endpoints represented by this ServerEndpoint. This could occur, for example, if an I/O resource associated with one of the communication endpoints is already in exclusive use, or if there are insufficient I/O resources for the operation.
@throws SecurityException if the current security context doesnot have the permissions necessary to listen for requests on one of the communication endpoints represented by this ServerEndpoint
@throws IllegalArgumentException if an invocation of theaddListenEndpoint method on the supplied ListenContext returns a ListenCookie that does not correspond to the ListenEndpoint that was passed to it
@throws NullPointerException if listenContext isnull