B4J Question Resumable Subs - Wait For

mindful

Active Member
Licensed User
Can anyone provide some clarification what will happen if:

1. We use Wait For and the event will never raise ?
Take the following example in ABMaterial I animate some components and after I call RunAnimation an event should raise after the animation finished on the client (browser), but what if something happens with the client like connection problems and he will not raise the animation finished event will the server websocket be cleaned by the garbage collector or will be left in the memory waiting for animation finished event to raise ?

2. If I have two resumable subs that will for for the same event is it possible that the first sub will catch the event that is expected by the second sub ?
1. Call to ResumableSub1
2. In the ResumableSub1 we call some method that when it finishes will raise TheEvent but it will finish in minimum 10 seconds
3. Call to ResumableSub2
4. In the ResumableSub2 we call some method that when it finishes will raise the same TheEvent but it will finish in minimum 5 seconds
So after 5 seconds which sub gets resumed ?
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Well i have just used wait for, for 5 minutes but i have some insight

1. We use Wait For and the event will never raise ?

The same that happens if you have them separetely.

Take the following example in ABMaterial I animate some components and after I call RunAnimation an event should raise after the animation finished on the client (browser), but what if something happens with the client like connection problems and he will not raise the animation finished event will the server websocket be cleaned by the garbage collector or will be left in the memory waiting for animation finished event to raise ?

It will wait for the event to raise, but you should keep informed the user AND maybe use the disconnected event to try to connect later on.
The next time you call another wait for without sender, then it will erease that previous call.

2. If I have two resumable subs that will for for the same event is it possible that the first sub will catch the event that is expected by the second sub ?

as Erel mentioned: If you do it without sender, it will release the previous call, if you do it with sender it will create another instance.
 
Upvote 0
Top