[Flashr] Priority Queue Question

Kelvin Luck kelvin at kelvinluck.com
Sun Sep 10 14:58:54 EDT 2006


Hi again,

OK - I've added this functionality into Flashr:
https://mirror1.cvsdude.com/trac/osflash/flashr/changeset/82

Just grab the latest version via subversion to get the changes. I added 
FlashrRequestQueue.getTopPriority, FlashrRequest.setPriority and 
FlashrRequestQueue.setPriority - they should be pretty self explanatory...

FlashrRequest.setPriority seemed a little cleaner to call than 
FlashrRequestQueue.setPriority although as you will see it just forwards 
the call on to that method anyway...

You also asked for:

 > _flashrQueue.getLowestPriority();

Did you mean to get the back of the queue using this? You don't need to 
worry about this as if you add an item without specifying a priority it 
has a priority of Number.MAX_VALUE assigned to it so will always sit at 
the end of the queue.

Please try it out and let me know if you have any problems or feedback,

Cheers,

Kelvin :)

Mario Klingemann wrote:
> Okay, looks like this here works:
> 
> _flashrQueue = FlashrRequestQueue.getInstance();
> [...]
> _flashrQueue.removeFromQueue( storedRequest ) ;
> _flashrQueue.addToQueue( storedRequest , -1 ) ;
> 
> I think it would be nice to have something like:
> 
> _flashrQueue.setPriority( storedRequest , x ) ;
> and
> _flashrQueue.getLowestPriority();
> 
> Mario
> 
> 
> Mario Klingemann schrieb:
>> Looks like I'm blind, but I do not find the way how to change the 
>> priority of a request after I have sent it to the queue.
>>
>> What I want to achieve is that for example after I have sent off 50 
>> requests, I discover that the user wants to see request #25 first. So 
>> in that case I'd like to move request #25 to the front of the queue. 
>> I'd image to have something like a FlashrRequest.processNext() method.
>>
>> Or is the currently intended method to cancel the old request and then 
>> use a new one with executeAtPriority 
>> <#com.kelvinluck.flashr.core.Flashr.executeAtPriority>() ?
>>
>> Mario
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Flashr mailing list
>> Flashr at osflash.org
>> http://osflash.org/mailman/listinfo/flashr_osflash.org
>>   
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Flashr mailing list
> Flashr at osflash.org
> http://osflash.org/mailman/listinfo/flashr_osflash.org



More information about the Flashr mailing list