com.neeve.link
Class LnkSynchronousAcceptor

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

public final class LnkSynchronousAcceptor
extends LnkObject

Synchronously accepts a link connection.

This class is a helper class that enables the user to synchronously accept incoming link requests. The user invokes run(com.neeve.link.ILnkServerEndpoint, int) with a server endpoint and a maximum timeout that the method should block and wait for an incoming link connection request. The method will block and wait for an incoming connection and will return when either a link is successfully accepted or the timeout expires.

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

Method Summary
static LnkSynchronousAcceptor create()
          Create a synchronous acceptor.
 ILnkPeerEndpoint run(ILnkServerEndpoint sep, int timeout)
          Synchronously accept an incoming 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
 

Method Detail

create

public static LnkSynchronousAcceptor create()
Create a synchronous acceptor.

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

run

public final ILnkPeerEndpoint run(ILnkServerEndpoint sep,
                                  int timeout)
                           throws ELnkInvalidStateException,
                                  ELnkOpFailedException
Synchronously accept an incoming link connection.

Parameters:
sep - The server endpoint through which to execute the accept.
timeout - The maximum amount of time (in millseconds) to wait for a link connection to be accepted. This parameter must be a positive number.
Returns:
Returns the peer endpoint for the accepted 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 server endpoint is safe for concurrent access.


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