want to the type of the thread created by newSingleThreadExecutor. http://download.oracle.com/javase/1.5.0/docs/guide/concurrency/overview.html shows we can 开发者_如何学JAVAcreate thread in a single background thread (as with events in Swing) or in a newly created thread. But how to control?
The documentation of newSingleThreadExecutor()
specifies that it is (almost) the same as using newFixedThreadPool(1)
, so each call to that method will create an executor with its own thread. That thread will not be a daemon thread by default, but you could change that by providing your own ThreadFactory
that produces daemon threads.
精彩评论