SequencerReceiverHelper
Helper class for the receiving side on one way binder transactions.
Binder transactions are handled on the binder thread pool. As such, one way transactions sent by a sender can be handled out of sequence. It just depends on the scheduling. The SequencerReceiverHelper helps solving this issue by running actions in sequence as sent by the sender based on a sequence ID. In case a transaction remains out of sequence for more than 5s, a timeout error will throw an IllegalStateException.
The use of one way transaction can be desired when the sender does not want to get blocked on the receiving side.
This class can also be used to ensure non one way transactions are in sequence with one way transactions.
The sequence IDs can be added to the transaction by using the SequencerSenderHelper.
Parameters
The CoroutineScope in which the coroutine responsible for throwing an error in case of out-of-sequence timeout will be running.
The optional CoroutineContext in which the coroutine responsible for throwing an error in case of out-of-sequence timeout will be running. Defaults to EmptyCoroutineContext, should only be changed for testing purposes.
See also
for one way transaction details.