com.neeve.emx
Interface IEmxNwLnkServerEndpoint

All Superinterfaces:
IEmxNwLnkEndpoint

public interface IEmxNwLnkServerEndpoint
extends IEmxNwLnkEndpoint

The EMX Network Link Server Endpoint interface.

Am EMX network link server endpoint is used to accept incoming link connection requests.Link connection requests are initiated by link client endpoints. All address related information on which to listen for incoming connection requests is specified at the server endpoint creation time and is implementation specific.

The connection acceptance operation is non-blocking in nature. The user requests the acceptance of the connection using the accept(com.neeve.emx.EmxNwLnkOpWaitCond) method. If successful, the method returns a IEmxNwLnkPeerEndpoint for use to exchange data with the established link's other peer endpoint. If no connection is waiting to be accepted, the method returns null with enough information in the wait conditions parameter passed to the accept method to inform the caller with all the conditions the caller needs to wait for before invoking the accept method again. In such a case, it is the responsibility of the caller to parse the wait conditions parameter, wait on the specified conditions (using an EMX dispatcher) and reinvoke the accept method when the conditions have been satisfied. The method throws an exception in case the acceptance attempt failed for some reason.

The user is free to accept additional incoming connection requests subsequent to a successful call to accept. This would normally be the case since a server endpoint would typically be used to accept incoming connection requests from several client endpoints.

The user should invoke the close() method when done using the server endpoint. This will release all operating system resources allocated to the server endpoint. It is illegal to post accepts subsequent to closing the endpoint.

The link server endpoint implements the ICommandHandler interface enabling the user to configure and control the the endpoint and the underlying network link at runtime. Commands cannot be issued to a server link endpoint subsequent to the closure of the endpoint.

Threading:
An EMX network link server endpoint is not safe for concurrent access by multiple threads.

Method Summary
 IEmxNwLnkPeerEndpoint accept(EmxNwLnkOpWaitCond waitCond)
          Accept of an incoming connection request.
 void close()
          Close a server endpoint.
 

Method Detail

accept

IEmxNwLnkPeerEndpoint accept(EmxNwLnkOpWaitCond waitCond)
                             throws EEmxInvalidStateException,
                                    EEmxNwLnkOpFailedException
Accept of an incoming connection request.

Parameters:
waitCond - This parameter (has to be non-null) is used to communicate wait conditions to the caller to determine when a new incoming connection request has arrived to be accepted. The caller should parse this parameter, wait on the conditions specified and reinvoke this method when the conditions have been satisfied.
Returns:
Returns an IEmxNwLnkPeerEndpoint object in case a link connection was successfully accepted. Returns null in case no incoming request could be accepted immediately. In both cases, the waitCond parameter contains the conditions on which the caller should wait before retrying the connection acceptance.
Throws:
EEmxInvalidStateException - This exception is thrown in case the endpoint has been closed.
EEmxNwLnkOpFailedException - This exception is thrown in case the acceptance operation failed for some reason.

This method accepts an incoming network link connection request from a client endpoint. A successful return from this method, indicated by a non-null return value, signifies that a connection has been successfully accepted and the user can use the returned peer endpoint to exchange data with the other link endpoint. The method populates the provided wait conditions object with the appropriate set of events that the caller should wait on to detect when to retry the accept again. Retrying the accept upon the satisfaction of the specified conditions does not guarantee that a connection will be successfully accepted. It is permissible for this method to return null on successive invocation even if the caller has waited on all specified conditions between invocations.

The user is free to accept additional incoming connection requests subsequent to a successful call to accept. This would normally be the case since a server endpoint would typically be used to accept incoming connection requests from several client endpoints.

Threading:
This method is not safe for concurrent access by multiple threads.

close

void close()
           throws EEmxInvalidStateException,
                  EEmxNwLnkOpFailedException
Close a server endpoint.

Specified by:
close in interface IEmxNwLnkEndpoint
Throws:
EEmxInvalidStateException - This exception is never thrown by a server endpoint i.e. it is permissible to close a server endpoint at any point after creation.
EEmxNwLnkOpFailedException - This exception is thrown in case an error was encountered while closing the server endpoint.

This method is used to close a server endpoint and release all underlying system resources allocated to the server endpoint. A user would invoke this method upon being done with accepting incoming connect requests and prior to releasing the endpoint for garbage collection. It is illegal to post an accept on a closed endpoint.

Threading:
This method is not safe for concurrent access by multiple threads.


Copyright © 2015 Neeve Research, LLC. All Rights Reserved.