-1

Suppose there are 4 BroadcastReceivers and there is an application sending Ordered Broadcast to all of them. All four broadcast receivers are in their own separate processes. If something goes wrong in between(e.g something fails in one of the in between onReceive methods) how can atomicity be ensured for ordered android broadcasts?

Does it depends on use case or there is a general mechanism that can be employed?

Update

What Atomicity means exactly in case of ordered broadcast, I can only guess. For example if series of transactions are being performed in receivers, is it possible to revert all transactions upon any failure in between? Does it even make sense to talk about Atomicity in this context?

Abhishek Bansal
  • 5,197
  • 4
  • 40
  • 69
  • 1
    It is unclear what "atomicity" has to do with broadcasts and receivers. You may wish to greatly expand your question and explain in greater detail what you mean by "atomicity" in this context. – CommonsWare Jun 15 '18 at 10:54

1 Answers1

1

Android sends the ordered broadcast to each BroadcastReceiver serially, one after another. If something fails, Android will just continue by sending the ordered broadcast to the next BroadcastReceiver.

Android handles sending the ordered broadcast from a system process, so even if one of the receiver processes crashes, Android can still continue to deliver the broadcast to the next BroadcastReceiver.

Does that answer your question? I'm with @CommonsWare on this one as I don't know what you mean by "atomicity" in this context.

David Wasser
  • 93,459
  • 16
  • 209
  • 274