com.neeve.link
Class LnkClientEndpoint

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.link.LnkObject
          extended by com.neeve.link.LnkClientEndpoint
All Implemented Interfaces:
ILnkClientEndpoint, ILnkEndpoint

public final class LnkClientEndpoint
extends LnkObject
implements ILnkClientEndpoint

Client endpoint class.

This class implements the ILnkClientEndpoint interface. Internally, this class implements a portion that is common to all client endpoint implementations and a portion that is link type specific. The class abstracts link type specific implementations via the ILnkClientEndpointCore interface. At endpoint creation time, link type specific implementations wrap an instance of this class around the actual implementation and return the wrapped class to the user as ILnkClientEndpoint.


Field Summary
 
Fields inherited from interface com.neeve.link.ILnkEndpoint
IOFLAG_FLUSH_FORCE, IOFLAG_FLUSH_SUPPRESS, IOFLAG_IMMEDIATE_DISPATCH, IOFLAG_NO_ASYNC, LVFLAG_ALLOW_FLUSH_PENDING, LVFLAG_SUPPRESS_IMPLICT_CLOSE
 
Method Summary
 void close()
          Implementation of ILnkClientEndpoint.close()
 void connectCancel(int flags)
          Implementation of ILnkClientEndpoint.connectCancel(int)
 void connectPost(IEmxDispatcher dispatcher, ILnkEventHandler handler, int timeout, int flags)
          Implementation of ILnkClientEndpoint.connectPost(com.neeve.emx.IEmxDispatcher, com.neeve.link.ILnkEventHandler, int, int)
static ILnkClientEndpoint create(RootConfig.ObjectConfig config, ILnkClientEndpointCore cep)
          Create a link client endpoint
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static ILnkClientEndpoint create(RootConfig.ObjectConfig config,
                                        ILnkClientEndpointCore cep)
Create a link client endpoint

Parameters:
config - The package configuration object to use in the creation of this object. The allows the parameters used to configure the package that is using this class to be automatically applied to this object too.
cep - The link client endpoint implementation to wrap around.

connectPost

public final void connectPost(IEmxDispatcher dispatcher,
                              ILnkEventHandler handler,
                              int timeout,
                              int flags)
                       throws ELnkInvalidStateException,
                              ELnkNotOwnerException,
                              ELnkOpFailedException
Implementation of ILnkClientEndpoint.connectPost(com.neeve.emx.IEmxDispatcher, com.neeve.link.ILnkEventHandler, int, int)

Specified by:
connectPost in interface ILnkClientEndpoint
Parameters:
dispatcher - The dispatcher in whose context the completion event will be dispatched. It is required that the invoking thread be the owner of this dispatcher.
handler - The event handler that will receive the completion event.
timeout - The maximum time (in milliseconds) to attempt to establish the connection. If the connection could not be established within the specified time, the connection establishment is aborted and a completion event is dispatched with an exception indicating a timeout. A value of 0 indicates that there is no time limit for the connection establishment.
flags - Flags that qualify the connect operation. The following flags are permitted for use in this method:
- ILnkEndpoint.IOFLAG_IMMEDIATE_DISPATCH - ILnkEndpoint.IOFLAG_NO_ASYNC
Throws:
ELnkInvalidStateException - Thrown in case there is a connect operation already in progress or the connection has already been successfully established.
ELnkNotOwnerException - Thrown in case this method is invoked by a thread that is not the owner of the specified dispatcher.
ELnkOpFailedException - This exception is thrown in case the connection establishment could not be successfully initiated.
See Also:
ILnkClientEndpoint.connectCancel(int)

connectCancel

public final void connectCancel(int flags)
                         throws ELnkInvalidStateException,
                                ELnkNotOwnerException
Implementation of ILnkClientEndpoint.connectCancel(int)

Specified by:
connectCancel in interface ILnkClientEndpoint
Parameters:
flags - Flags that qualify the connect cancellation operation. Currently, there are no supported flags for use, This parameter is present for future use. The user should specify a value of 0 in this parameter.
Throws:
ELnkInvalidStateException - Thrown in case the user is attempting a cancellation of a connect operation that was not initiated.
ELnkNotOwnerException - Thrown in case this method is invoked by a thread that is not the owner of the dispatcher specified in the earlier call to ILnkClientEndpoint.connectPost(com.neeve.emx.IEmxDispatcher, com.neeve.link.ILnkEventHandler, int, int).

This method cancels a previously posted connect operation. A successful return from this method indicates that the connect operation has been cancelled. The user will be dispatched a connect completion event containing ELnkOpCancelledException indicating that the connect operation was cancelled by the user.

See Also:
ILnkClientEndpoint.connectPost(com.neeve.emx.IEmxDispatcher, com.neeve.link.ILnkEventHandler, int, int)

close

public final void close()
                 throws ELnkInvalidStateException,
                        ELnkNotOwnerException,
                        ELnkOpFailedException
Implementation of ILnkClientEndpoint.close()

Specified by:
close in interface ILnkClientEndpoint
Throws:
ELnkInvalidStateException - Thrown in case the user is attempting to close an endpoint that is either connected or has a connect currently in progress in the background.
ELnkNotOwnerException - Thrown in case a connect is currently in progress and this method is invoked by a thread that is not the owner of the dispatcher that is driving the connect operation.
ELnkOpFailedException - This exception is thrown in case an error was encountered while closing the endpoint.

This method is used to close an unconnected client endpoint and release all operating system resources allocated to the client endpoint. It is illegal to invoke this method on a connected endpoint. The purpose of this method is to allow the user to release all underlying resources upon abandonment of the connection establishment process.



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