com.neeve.link
Class LnkSynchronousConnector

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.link.LnkObject
          extended by com.neeve.link.LnkSynchronousConnector

public final class LnkSynchronousConnector
extends LnkObject

Synchronously established a link connection.

This class is a helper class that enables the user to synchronously establish a link connection. The user invokes run(com.neeve.link.ILnkClientEndpoint, int) with a client endpoint and a maximum timeout that the method should block and wait for the connection establishment to complete. The method establish the connection and return when either the connection has been successfully established, an error occurs or the timeout expires.

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

Constructor Summary
LnkSynchronousConnector()
          Create a synchronous connector.
 
Method Summary
static LnkSynchronousConnector create()
          Create a synchronous connector.
 ILnkPeerEndpoint run(ILnkClientEndpoint cep, int timeout)
          Synchronously establish a link connection.
 
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
 

Constructor Detail

LnkSynchronousConnector

public LnkSynchronousConnector()
Create a synchronous connector.

Method Detail

create

public static LnkSynchronousConnector create()
Create a synchronous connector.

Returns:
Returns the created synchronous connector.
Threading:
This method is safe for concurrent access by multiple threads.

run

public final ILnkPeerEndpoint run(ILnkClientEndpoint cep,
                                  int timeout)
                           throws ELnkInvalidStateException,
                                  ELnkOpFailedException
Synchronously establish a link connection.

Parameters:
cep - The client endpoint through which to execute the connect.
timeout - The maximum amount of time (in millseconds) to wait for a link connection establishment to complete (successfully or not) This parameter must be a positive number.
Returns:
Returns the peer endpoint for the connected link.
Throws:
ELnkInvalidStateException - Thrown in case the supplied endpoint is in a state that does not permit a connect to be posted on it.
ELnkOpFailedException - Thrown in case the link connection could not be successfully established.
ELnkOpTimeoutException - Thrown in case the timeout expired before the link connection could be established.
Threading:
This method is safe for concurrent access by multiple threads provided the specified client endpoint is safe for concurrent access.


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