com.neeve.link
Class LnkSTRRunnableContainer

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.link.LnkObject
          extended by com.neeve.link.LnkContainer
              extended by com.neeve.link.LnkSTRContainer
                  extended by com.neeve.link.LnkSTRRunnableContainer
All Implemented Interfaces:
ILnkRunnableContainer
Direct Known Subclasses:
ClientLinkManager

public class LnkSTRRunnableContainer
extends LnkSTRContainer
implements ILnkRunnableContainer

A runnable LnkSTRContainer.

This class extends LnkSTRContainer by providing a mechanism by which the reader thread associated with the container is run. The mechanism is defined by ILnkRunnableContainer which this class implements.

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

Field Summary
 
Fields inherited from class com.neeve.link.LnkContainer
RMFLG_ALLOW_READ_OPERATIONAL
 
Method Summary
 Object run(IEmxDispatcher reader, int timeout, ILnkContainerRunCompletionChecker completionChecker)
          Drive the container's reader.
 Object run(int timeout, ILnkContainerRunCompletionChecker completionChecker)
          Drive the container's reader.
 
Methods inherited from class com.neeve.link.LnkSTRContainer
createTemporary, getCurrentReader, getReader, isCompatible, startRead, stopRead, toString
 
Methods inherited from class com.neeve.link.LnkContainer
getCount, getLink, getLinks, getName, touch, touch
 
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, wait, wait, wait
 

Method Detail

run

public final Object run(IEmxDispatcher reader,
                        int timeout,
                        ILnkContainerRunCompletionChecker completionChecker)
                 throws ELnkOpTimeoutException,
                        ELnkException
Drive the container's reader.

This method runs the container reader's event dispatch loop (by invoking (IEmxDispatcher.run(int)) for a maximum of the specified timeout or until the user explictly terminates the run via the completion checker.

Specified by:
run in interface ILnkRunnableContainer
Parameters:
reader - The container reader to drive.
completionChecker - The completion checker object that this method will consult to determine whether to return or not.
Returns:
Returns the object returned by the completion checker.

This method drives the read machinery of all the link trees that have been associated with this container using LnkContainer.startRead(com.neeve.link.ILnkPeerEndpoint) using one of the container's readers. The method is passed a timeout and a completion checker object. The method will return when either the timeout expires or the completion checker indicates that the run should terminate.

Throws:
ELnkOpTimeoutException - Thrown if the timeout occurred before the completion checker indicated completion.
ELnkException - Thrown in case an error occurs during the running of the thread.

run

public final Object run(int timeout,
                        ILnkContainerRunCompletionChecker completionChecker)
                 throws ELnkOpTimeoutException,
                        ELnkException
Drive the container's reader.

This method runs the container reader's event dispatch loop (by invoking (IEmxDispatcher.run(int)) for a maximum of the specified timeout or until the user explictly terminates the run via the completion checker.

Specified by:
run in interface ILnkRunnableContainer
Parameters:
timeout - The maximum timeout (in milliseconds) to drive the link trees. A value of -1 indicates infinite timeout.
completionChecker - The completion checker object that this method will consult to determine whether to return or not. This parameter can be null in which case the method will return only on timeout or error.
Returns:
Returns the object returned by the completion checker.

This method drives the read machinery of all the link trees that have been associated with this container using LnkContainer.startRead(com.neeve.link.ILnkPeerEndpoint) concurrently using all the container's readers. The method is passed a timeout and a completion checker object. The method will return when either the timeout expires or the completion checker indicates that it should.

Throws:
ELnkOpTimeoutException - Thrown if the timeout occurred before the completion checker indicated completion.
ELnkException - Thrown in case an error occurs during the running of the threads.


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