Priority BlockingQueue stream in Java 8 not working




These two code snippets have different output order. First part:



```
while(!jobQueue.isEmpty()) {
    TimeoutJobRequest job = jobQueue.peek();
    if(job.isReady()) {
        execute(job);
        jobQueue.poll();
    } else {
        return;
    }
}

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

Second part:



```
jobQueue.stream()
        .filter(TimeoutJobRequest::isReady)
        .peek(jobQueue::remove)
        .forEach(this::execute);

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

Please note that `jobQueue`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

is `PriorityBlockingQueue`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.


Reordering only happens when `this::execute`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

relatively long (like a couple of seconds).
`stream`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

of `PriorityBlockingQueue`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

follows the order `Iterator`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, which according to the [documentation](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=) :



>  The iterator provided in the iterator () method is not guaranteed to traverse the PriorityBlockingQueue elements in any particular order.
> 
> 
> 


If you want order of precedence, you need `poll`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

items from `PriorityBlockingQueue`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  


```
PriorityBlockingQueue<Integer> pq = new PriorityBlockingQueue<>();
pq.add(5);
pq.add(8);
pq.add(3);

System.out.println("-- Try 1 --");
pq.stream().forEach(System.out::println);

System.out.println("-- Try 2 --");
IntStream.range(0, pq.size()).map(i -> pq.poll()).forEach(System.out::println);

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

Conclusion (this may depend on Java implementation):



```
-- Try 1 --
3
8
5
-- Try 2 --
3
5
8

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```
May be the function is executed before the document is ready.
Try to use document.ready function like this:



```
$( document ).ready(function() {
    $('#machines').change(function() {
        var $selected = $(this).find(':selected');
        $('#description').html($selected.data('description'));
    }).trigger('change');
});

``` hey [@fastwayjim](/forum/u/fastwayjim)

i could reproduce the behavior. of course this should not be the case. when you start a job first the data needed for the computation is processed before being transferred to a computation instance. if there is no instance available a new one has to be started and your job gets into… @himmer, thanks for looking into it. that is a way newer jdk, so you may be right.

the problem comes from sorting “drawables” which are jzy3d primitives. it is this [call](https://github.com/jzy3d/jzy3d-api/blob/2bc67d0f803d8bf11b1e93a72a34653aa0766bad/jzy3d-core/src/main/java/org/jzy3d/plot3d/rendering/ordering/abstractorderingstrategy.java#l29-l39) that causes the issue. but the developers are aware of it, and even mention it in the code. i will followup with them, thanks! hi, everyone!

this should now be fixed and working as expected for you.

if you aren’t seeing the fix you may need to clear your cache.

if this doesn’t resolve your issue, please reach back out and i’ll be happy to assist you further! :webflow\_heart: Your example file doesn't include any sound.The simplest solution would be to include this line in your replay code, before the this.gotoAndPlay(2) line: createjs.Sound.stop(); The problem is in your document.ready script:



```
$("#datepicker").datepicker();
```

This is returning an error that it is not a function. I'm not sure how the actual call should be, but check the documentation on that. hi,
thanks that does help tremendously! what you're dealing with is a "wait until ready" timeout condition. in other words test studio timed out waiting for the browser to say "i'm done downloading and rendering all the data for this website". there is a global setting for this which has a default value of just 30 seconds. it is the "client ready timeout" setting as shown in the [last figure on this page](http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/test-execution/quick-execution.aspx) for quick execution. an equivalent setting exists in [the test list settings](http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/test-execution/test-list-settings.aspx) when running your tests as part of a test list..  

  

if you don't want to set it globally (which can make sense to have the timeout much shorter for the remainder of your test) you'll have to resort to performing your navigate step in code... but it's pretty easy. try this:  

  


`int` `oldvalue = manager.settings.clientreadytimeout;`
`manager.settings.clientreadytimeout = 360000;`
`activebrowser.navigateto(``"my website here"``);`
`manager.settings.clientreadytimeout = oldvalue;`




kind regards,  

 cody   

the telerik team


do you want to have your say when we set our development plans?
do you want to know when a feature you care about is added or when a bug fixed?
explore the [telerik public issue tracking](http://www.telerik.com/support/pits.aspx)
system and vote to affect the priority of the items its to do with the jit optimisation, the same is true if you insert conditional debug statement in the code, matlab needs to prepare to stop execution. Hi Lena,

Message Center deliveries are Continuous deliveries. As soon as you get a new event related to that delivery, the email delivery status will get set to InProgress followed by Finished or Retry Pending.

Before deciding on deletion, we should help identify why it is failing. Definitely there is something wrong on yoru template.

If you fix that, this problem will go away.

Can you please point out the error that causes the delivery to fail?

If you still wish to get rid of problematic delivery, right click on its record in List View and hit Stop.

Regards,

Vipul




[View solution in original post](/t5/adobe-campaign-standard/is-it-ok-to-delete-erroneous-deliveries/m-p/303524#M5132) A trigger is not what you want.


What you need is a scheduled job.


Take a look at the official documentation on the subject:


[Scheduling Jobs with Oracle Scheduler](http://docs.oracle.com/cd/B28359_01/server.111/b28310/scheduse.htm#i1033533)


Feel free to ask more questions if you find any trouble when creating your scheduled job.