For the first review very simple task. I have two objects A and B
Next algorithm:
- Run scheduler
- A - send message to B and B receive message
- After 10 seconds A and B need to swap
- B - send message to A
- ...
So, each 10 seconds need to swap sender and receiver.
This is very rude code, just for example
swap(A, B)
val res = send(A)
Thread.sleep(10000)
res.cancel
swap(A, B)
val res2 = send(B)
Thread.sleep(10000)
res2.cancel
...
Do you know some approach or pattern for this aim?
Thanks.
BR!
Aucun commentaire:
Enregistrer un commentaire