Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
EnTerr
Level 8

roUrlTransfer: AsyncGet - re-entrant? GC okay?

I am trying to use the asyncronous methods of roUrlTransfer and have couple of questions i could not find in RTFM the answer to:

  1. Are the Async methods re-entrant? E.g. can i call AsyncGetToString() multiple times on the very same object and rely it will not bomb - that is >1 async calls from the same object can run in the background and will send events. Or are roUrlTransfer objects strictly one-time/single-use/disposable.

  2. Is it okay not to hold a reference to a roUrlTransfer object after the Async method was called? Or should i hold on for dear life to the object, even if i am not going to use it - lest it will explode in my face.

As an explanation of use, i intend to start multiple transfers in parallel - and if (1) Async calls are re-entrant, i may just use a single roUrlTransfer object and sort out the results based on roUrlEvent only. If that is not the case, then i'll use 1 roUrlTransfer per 1 async call and then (2) becomes relevant - do i need to keep reference to these objects (like stuff them in array for no reason of my own but just to keep ref.count > 0) - or can i invalidate my reference (like say using the same variable in a loop, re-assigning it with createObject() on each iteration) and trust Roku will still finish the async calls?

PS. bonus question - how many roUrlTransfer requests maximum before player meets untimely demise?
0 Kudos
2 Replies
TheEndless
Level 7

Re: roUrlTransfer: AsyncGet - re-entrant? GC okay?

I'll take a stab...

  1. ifUrlTransfer.GetIdentity() correlates to roUrlEvent.GetSourceIdentity(), and as far as I'm aware, that's the only way to identify which request a given roUrlEvent relates to. You should be able to re-use an roUrlTransfer object, but not concurrently with other requests from the same instance.

  2. The request gets disposed as soon as the roUrlTransfer goes out of scope, so if you don't keep a reference to the object, you'll lose most, if not all, of the requests.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Level 8

Re: roUrlTransfer: AsyncGet - re-entrant? GC okay?

Later I got to the same practical conclusions on (1) and (2) after some trial & error.
@Roku people: but this should be documented, no? - not at all obvious.

I used .getIdentity() to maintain a "stable" of a few hundred workhorse roUrlTransfers, because in my case the answer to (3) seemed to be ~1000 (YAWRR: thereabout a thousand requests will crash & reboot a Roku3). Takes some effort to manage them but the amount of grazing these - ok, so maybe "work-goats" - can do is impressive!
0 Kudos