[Flashr] Priority Queue Question

Mario Klingemann mario at quasimondo.com
Mon Sep 11 09:17:39 EDT 2006


Hi Kelvin,

that sound great - thanks for the quick update!
> 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...
Absolutely.
> 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...
>   
Yes - that's where I would look for it first. Very good!

> 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.
>
>   
Since the documentation says that the lower the number, the higher the 
priority I actually meant with it to get the priorityLevel which gets 
served next - which is now  getTopPriority and which is of course way 
more logical.

Cheers
Mario



> 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
>>     
>
> _______________________________________________
> Flashr mailing list
> Flashr at osflash.org
> http://osflash.org/mailman/listinfo/flashr_osflash.org
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/flashr_osflash.org/attachments/20060911/8191a413/attachment.htm


More information about the Flashr mailing list