com.neeve.link
Class ILnkPeerEndpoint.AsynchronousFlushContext

java.lang.Object
  extended by com.neeve.link.ILnkPeerEndpoint.FlushContext
      extended by com.neeve.link.ILnkPeerEndpoint.AsynchronousFlushContext
Enclosing interface:
ILnkPeerEndpoint

public static final class ILnkPeerEndpoint.AsynchronousFlushContext
extends ILnkPeerEndpoint.FlushContext

Context for asynchronous flushing through a peer endpoint..

The user provides an instance of this class to the ILnkPeerEndpoint.enque(short, com.neeve.pkt.PktPacket, com.neeve.link.ILnkPeerEndpoint.FlushContext, int) and ILnkPeerEndpoint.flush(short, com.neeve.link.ILnkPeerEndpoint.FlushContext) methods to request for asynchronous flush semantics. In case the enque method did not flush the endpoint, none of the fields in this context are altered. In case the endpoint was flushed (implictly via the enque method or explicitly via the flush method) and the flush completed synchronously, the syncComplete flag is set. In case the flush could not complete synchronously, the inProgress flag is set to indicate that the flush has been scheduled for background completion. In such a case, the user is responsible for driving the dispatcher to drive the flush to completion. Upon completion of the flush, the inProgress flag is reset and the LnkEvents.EVENT_FLUSH_COMPLETE event is dispatched to the users registered event handler.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.neeve.link.ILnkPeerEndpoint.FlushContext
ILnkPeerEndpoint.FlushContext.FlushMode
 
Field Summary
 IEmxDispatcher dispatcher
          [IN] The dispatcher to use in case the flush is to be scheduled for asynchronous completion.
 boolean inProgress
          [OUT] Indicates whether the flush was scheduled for asynchronous completion.
 Exception status
          [OUT] Contains the status of the flush completion.
 boolean syncComplete
          [OUT] Indicates whether the flush completed synchronously or not.
 
Fields inherited from class com.neeve.link.ILnkPeerEndpoint.FlushContext
flushMode
 
Constructor Summary
ILnkPeerEndpoint.AsynchronousFlushContext(IEmxDispatcher dispatcher)
          Construct using a dispatcher.
 
Method Summary
 void reset()
          Implemented FlushContext method.
 void setDispatcher(IEmxDispatcher dispatcher)
          Reset the flush context dispatcher.
 String toString()
          String representation.
 
Methods inherited from class com.neeve.link.ILnkPeerEndpoint.FlushContext
getAttachment, setAttachment
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dispatcher

public volatile IEmxDispatcher dispatcher
[IN] The dispatcher to use in case the flush is to be scheduled for asynchronous completion.

The dispatcher in which context the flush will be submitted for asynchronous completion in case the flush cannot be completed synchronously. Upon return from the enque or flush method, in case the inProgress flag is set, the user needs to drive the dispatcher to drive the flush to completion. Upon completion of the flush, the inProgress flag is reset and the flush complete event dispatched to the user's registered event handler.


inProgress

public volatile boolean inProgress
[OUT] Indicates whether the flush was scheduled for asynchronous completion.

Upon return from the enque or flush method, this flag will be set in case the method attempted the flush, could not complete it synchronously and has scheduled it for asynchronous completion. If set, te user needs to drive the provided dispatcher until the flush completes i.e. the flush completion event is dispatched and/or this flag is reset.


syncComplete

public volatile boolean syncComplete
[OUT] Indicates whether the flush completed synchronously or not.

Upon return from the enque or flush method, this flag will be set if the method flushed the endpoint and the flush completed synchronously. If set to false, it indicates that either the flush was not initiated or was initiated and is completing asynchronously. The user can differentiate between these two cases by inspecting the inProgress flag. The inProgress flag will be set in the latter case. This flag is always set to false when the flush completion event is dispatched.


status

public volatile Exception status
[OUT] Contains the status of the flush completion.

Constructor Detail

ILnkPeerEndpoint.AsynchronousFlushContext

public ILnkPeerEndpoint.AsynchronousFlushContext(IEmxDispatcher dispatcher)
Construct using a dispatcher.

Method Detail

setDispatcher

public final void setDispatcher(IEmxDispatcher dispatcher)
Reset the flush context dispatcher.


reset

public final void reset()
Implemented FlushContext method.

Specified by:
reset in class ILnkPeerEndpoint.FlushContext

toString

public final String toString()
String representation.

Overrides:
toString in class ILnkPeerEndpoint.FlushContext


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