cgl.narada.service.reliable.impl
Class InvoicerThread

java.lang.Object
  extended by java.lang.Thread
      extended by cgl.narada.service.reliable.impl.InvoicerThread
All Implemented Interfaces:
RdDebugFlags, Runnable

public class InvoicerThread
extends Thread
implements RdDebugFlags

This class is responsible for ensuring retransmissions of NAKs and recovery requests. This thread needs to have reconfigurable parameters which ensures that parameters pertaining to retransmission can be easily specified.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface cgl.narada.service.reliable.impl.RdDebugFlags
InvoicerThread_Debug, NakProcessor_Debug, PublisherPercolator_Debug, RdEntityActuatorImpl_Debug, RdFragmentationHelper_Debug, RdPublishingEntityImpl_Debug, SubscriberPercolator_Debug
 
Constructor Summary
InvoicerThread(int entityId, EventProducer producer)
           
 
Method Summary
 RdAckInvoiceEntityEvent createAckInvoiceEvent(int templateId, Vector pendingAcksForTemplate)
          This method creates the appropriate AckInvoiceEntityEvent.
 void issueRecoveryRequest(RdRecoveryEntityRequest recoveryRequest)
           
 void manageNakRequest()
           
 void manageRecoveryRequest(RdRecoveryEntityRequest recoveryRequest)
           
 void manageRecoveryResponse(RdRecoveryResponse recoveryResponse)
           
 void processMissedSequence(int templateId, long missedSequence)
           
 void processMissedSequences(int templateId, long[] missedSequences)
           
 void processRetransmittedEvent(RdRetransmissionServiceEvent retransmitEvent)
           
 void processSyncAdvance(int templateId, long advanceSync)
          Check to see if the sync advancement implies that recovery on the recovering template is complete.
 void run()
           
 void terminateService()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvoicerThread

public InvoicerThread(int entityId,
                      EventProducer producer)
Method Detail

processMissedSequences

public void processMissedSequences(int templateId,
                                   long[] missedSequences)

processMissedSequence

public void processMissedSequence(int templateId,
                                  long missedSequence)

processRetransmittedEvent

public void processRetransmittedEvent(RdRetransmissionServiceEvent retransmitEvent)

issueRecoveryRequest

public void issueRecoveryRequest(RdRecoveryEntityRequest recoveryRequest)
                          throws ServiceException
Throws:
ServiceException

manageRecoveryRequest

public void manageRecoveryRequest(RdRecoveryEntityRequest recoveryRequest)
                           throws ServiceException
Throws:
ServiceException

manageRecoveryResponse

public void manageRecoveryResponse(RdRecoveryResponse recoveryResponse)
                            throws ServiceException
Throws:
ServiceException

manageNakRequest

public void manageNakRequest()

processSyncAdvance

public void processSyncAdvance(int templateId,
                               long advanceSync)
Check to see if the sync advancement implies that recovery on the recovering template is complete. If the advanceSync is equal to the associated donotAckUntil, recovery is considered to be complete.


createAckInvoiceEvent

public RdAckInvoiceEntityEvent createAckInvoiceEvent(int templateId,
                                                     Vector pendingAcksForTemplate)
This method creates the appropriate AckInvoiceEntityEvent. If this method returns a NULL it implies that there is nothing that needs to be acknowledged at the present time. One may have received events, but until recovery is complete we don't ack events received while "recovering" --- this ensures that there is not a retransmission explosion. Lets say a client leaves when it's sync is 400. After a few hours when it reconnects it receives event with seq -> 800 Now also, let us say that recovery response indicates that we have missed 250 events 500-750 When we ACK retransitted events we will be ACKing 800 also since it is not removed from the ACK set till the syncpoint for a template has actually been advanced to 800. So we keep getting ACKResponses which will have missed events between whatever was ACKed (say 510) and 800. This will trigger a NAK and so forth. The process then repeats itself over and over. This method addresses this problem and fixes it.


run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

terminateService

public void terminateService()
                      throws ServiceException
Throws:
ServiceException


For comments and suggestions please send e-mail to The NaradaBrokering Project