Worker threads for long-runners

19 views
Skip to first unread message

Oliver Plow

unread,
Dec 2, 2013, 4:18:15 AM12/2/13
to hawtdi...@googlegroups.com
Hello,

here is some scenario that makes me think. Let's say someone does some blocking operation aka starts some long running task such as querying something from a database. This is not the way HawtDispatch is intended to be used. I know. Question is now how to deal with that. In Vert.x they have so-called worker threads you need to use in case you do something that blocks for a while.

So what I would like to do in HawtDispatch is to reserve a certain fraction of those 10 threads of the HawtDispatchthread pool that are supposed to execute long-runners. The remaining threads remain always available to run non-blocking tasks. This way HawtDispatch cannot run into some starvation situation incurred by long-runners.

Is there a way in HawtDispatch to make sure long-runners only use specific threads reserved to serve long-runners? I can't see myself a way how I can get this accomplished with the interface provided by HawtDispatch. Some hint appreciated ;-).

Regards, Oliver

Hiram Chirino

unread,
Dec 2, 2013, 9:06:27 AM12/2/13
to hawtdispatch
Hi Oliver,

Just create your own ThreadPool and pass the long running task to be
executed on those thread. So yeah not done by HawtDispatch itself.
It's up you you to create and configure a thread pool for those long
running tasks.
> --
> You received this message because you are subscribed to the Google Groups
> "hawtdispatch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hawtdispatch...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Hiram Chirino

Engineering | Red Hat, Inc.

hchi...@redhat.com | fusesource.com | redhat.com

skype: hiramchirino | twitter: @hiramchirino

blog: Hiram Chirino's Bit Mojo
Reply all
Reply to author
Forward
0 new messages