Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
CoasterMaster
Aug 13, 2003

The Emperor of the Rides


Nap Ghost
I've got a bunch of tasks that need to get done (download some files and do some processing on them) and I'd like these to happen concurrently so I've been using a ThreadPoolExecutor and just shoving Runnables at it. Is there any sane way to have some tasks go to the front of the queue instead of the back (i.e. cutting in line?). There are two ways I've thought to do it:

1) have two ThreadPoolExecutors, one a normal one and one a 'priority' one and put all of the cutting tasks in the priority one

2) have a separate thread that keeps two queues, a normal and priority and continually monitors the ThreadPoolExecutor and gives it the correct job when it's needed.

Is there a better approach here?

Adbot
ADBOT LOVES YOU

CoasterMaster
Aug 13, 2003

The Emperor of the Rides


Nap Ghost
Is there a way to listen for keyboard events in a console app? It's fairly easy when using KeyListeners, but it looks like I can only use them on GUI apps.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply