Class ImmediateResolutionStrategy
-
- All Implemented Interfaces:
public final class ImmediateResolutionStrategy extends PingResolutionStrategy
A PingResolutionStrategy that attempts to resolve (send) pings immediately upon request. This strategy is typically used for high-priority pings.
Persistence order matters: the ping is persisted with
status = IN_PROGRESSbefore the network attempt. This is the crash-recovery invariant thatPingsDao.resetStaleStatus(called onPingComponent.start) andPingsDao.getUnExecutedFreshPings(strict-<oncreatedAt) rely on — if the process dies mid-flight, the row is re-IDLE'd on next boot and excluded from the fresh-recovery scan in the meantime.If the send is successful, the ping is removed. If it fails, the retry count is incremented. If the retry count exceeds the configured maximum, the ping is removed. A duplicate ping is not persisted, but still gets one immediate network attempt; its result is reported without removing or updating the existing row with the same ID. Listeners are notified of the outcome.
-
-
Field Summary
Fields Modifier and Type Field Description private final ConcurrentHashMap<String, WeakReference<PingResolutionStrategy.PingResolutionListener>>listeners
-
Constructor Summary
Constructors Constructor Description ImmediateResolutionStrategy(PingsDao dao)
-
Method Summary
Modifier and Type Method Description UnitstartProcessing()Starts any executor or background process associated with this strategy. UnitstopProcessing()Stops any executor or background process associated with this strategy. final UnitsetExecutorForTesting(HighPriorityExecutor executor)-
Methods inherited from class com.inmobi.media.pingsv2.strategy.PingResolutionStrategy
addListener, getListeners, removeListener, reservePing, resolvePing, setNetworkHandler -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
startProcessing
Unit startProcessing()
Starts any executor or background process associated with this strategy.
-
stopProcessing
Unit stopProcessing()
Stops any executor or background process associated with this strategy.
-
setExecutorForTesting
final Unit setExecutorForTesting(HighPriorityExecutor executor)
-
-
-
-