java - Why can't i instantiate ThreadPoolExecutor with BlockingQueue<Callable>; why only BlockingQueue<Runnable>? -
my understanding callable added in 1.5 , runnable interface kept as-is prevent world ending. why can't instantiate threadpoolexecutor
(core, max, tu, unit, new blockingqueue<callable>())
- why queue take runnable only? internally, if submit, invokeall, invokeany callables, should fine right? also, shutdownnow()
return list of callables?
you can submit callables
, wrapped internally runnables
(actually futuretasks
, implement runnable
). shutdownnow()
going return runnables
, says on tin.
if want list of callables
haven't been run, you'll need keep track of them somehow (e.g., keep list of them , make them responsible removing list when they're called.)
Comments
Post a Comment