0

how can I change a certain task priority if it's already on the blocking queue (assuming the poll is full) and I now want it to be on an higher priority?

E.G: implementing this answer

Specify task order execution in Java

I put thread poll of 3, send 8 tasks all with priority of 1.

Now 3 are executing and 5 are waiting for an available thread.

Now I want task number 3 on the waiting list to be priority 2, means it will execute right away when a thread is open before the other 4.

Can it be done?

P.S - I want to do it on an android app, is it recommended?

JimHawkins
  • 4,843
  • 8
  • 35
  • 55
sharon gur
  • 343
  • 5
  • 22

1 Answers1

1

If it's in the PriorityQueue already, changing the priority won't affect anything. You'd have to remove and re-insert it.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • if so, how can I remove a specific task? and can it be done if the executor got shut down already? (im shutting it down once all the requests are in queue) – sharon gur May 28 '15 at 07:02