public final class TransmissionPolicyManager extends java.lang.Object implements Stoppable, TransmissionHandlerObserver
TransmissionPolicy
The class will keep that state for the requested amount of time and will unbindFromRunawayChildThreads it, i.e. reset to 'unblock'
when the timeout expires.
Created by gupele on 6/29/2015.Constructor and Description |
---|
TransmissionPolicyManager(boolean throttlingIsEnabled)
Create the
TransmissionPolicyManager and set the ability to throttle. |
Modifier and Type | Method and Description |
---|---|
void |
addTransmissionHandler(TransmissionHandler handler)
Used to add a
TransmissionHandler to the collection stored by the
TransmissionPolicyManager . |
void |
backoff()
Suspend the transmission thread according to the current back off policy.
|
void |
clearBackoff()
Clear the current thread state and and reset the back off counter.
|
int |
getMaxInstantRetries()
Get the number of retries before performing a back off operation.
|
TransmissionPolicyStateFetcher |
getTransmissionPolicyState()
Get the policy state fetcher
|
void |
onTransmissionSent(TransmissionHandlerArgs transmissionArgs)
Called when a transmission is sent by the
TransmissionOutput . |
void |
setMaxInstantRetries(int maxInstantRetries)
Set the number of retries before performing a back off operation.
|
void |
stop(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Stop this transmission thread from sending.
|
void |
suspendInSeconds(com.microsoft.applicationinsights.internal.channel.common.TransmissionPolicy policy,
long suspendInSeconds)
Suspend this transmission thread using the specified policy
|
public TransmissionPolicyManager(boolean throttlingIsEnabled)
TransmissionPolicyManager
and set the ability to throttle.throttlingIsEnabled
- Set whether the TransmissionPolicyManager
can be throttled.public void backoff()
public void clearBackoff()
public void suspendInSeconds(com.microsoft.applicationinsights.internal.channel.common.TransmissionPolicy policy, long suspendInSeconds)
policy
- The TransmissionPolicy
to use for suspensionsuspendInSeconds
- The number of seconds to suspend.public void stop(long timeout, java.util.concurrent.TimeUnit timeUnit)
public TransmissionPolicyStateFetcher getTransmissionPolicyState()
TransmissionPolicyStateFetcher
objectpublic void onTransmissionSent(TransmissionHandlerArgs transmissionArgs)
TransmissionHandler
TransmissionOutput
.onTransmissionSent
in interface TransmissionHandler
transmissionArgs
- The TransmissionHandlerArgs
for this handler.public void addTransmissionHandler(TransmissionHandler handler)
TransmissionHandlerObserver
TransmissionHandler
to the collection stored by the
TransmissionPolicyManager
.addTransmissionHandler
in interface TransmissionHandlerObserver
handler
- The handler to add to the collection.public void setMaxInstantRetries(int maxInstantRetries)
maxInstantRetries
- Number of retriespublic int getMaxInstantRetries()