com.preemptive.instrumentation
Interface FlowController

All Known Implementing Classes:
ConfigurableFlowController, DefaultFlowController

public interface FlowController

A throttling mechanism for sending messages.


Method Summary
 int control(int numMessages, long deltaT)
          Called to control the transmission of messages.
 boolean hasBatchExpired(Date date, int attempts)
          Should the batch be deleted?
 int messagesToDrop(int currentMessageCount)
          Called to determine if messages should be dropped and if so, how many.
 boolean okToTransmit()
          Called to determine if it is OK to attempt a transmission
 void onSend(boolean success)
          Informs the FlowController if the a transmission attempt was successful or not, allowing it to determine if messages should still be sent.
 

Method Detail

control

int control(int numMessages,
            long deltaT)
Called to control the transmission of messages.

Parameters:
numMessages - Number of queued messages.
deltaT - The total time the last iteration took to send numMessages (pollInterval + sendTime) in ms.
Returns:
A new polling interval in ms.

messagesToDrop

int messagesToDrop(int currentMessageCount)
Called to determine if messages should be dropped and if so, how many.

Parameters:
currentMessageCount - The number of queued messages.
Returns:
The number of messages to drop.

okToTransmit

boolean okToTransmit()
Called to determine if it is OK to attempt a transmission


onSend

void onSend(boolean success)
Informs the FlowController if the a transmission attempt was successful or not, allowing it to determine if messages should still be sent.

Parameters:
success - TRUE if transmission was successful.

hasBatchExpired

boolean hasBatchExpired(Date date,
                        int attempts)
Should the batch be deleted?

Parameters:
date - The date/time the message batch was created.
attempts - The number of transmission attempts.
Returns:
true if the batch has expired and should be deleted.


Copyright © 2013 PreEmptive Solutions, LLC. All Rights Reserved.