hg: macosx-port/macosx-port/jdk: Fixing Toolkit selection issues at startup, auto-selecting headless when not in graphical session, auto-selecting XToolkit when /tmp/launch-8hl5J4/org.x:0 is set, installing eAWT app delegates to catch extended Mac app events, added default menu bar support, adding gesture support, adding GCD dispatch support, adding eIO filesystem support, moving LaF native code into osxui library along with other eAWT code, other misc cleanup and debug simplification.
Andrew Thompson
lordpixel+openjdk at mac.com
Wed Sep 7 19:52:37 PDT 2011
On Sep 7, 2011, at 11:13 AM, Mike Swingler wrote:
> As for proposing an SPI for adding executors, I hadn't really thought that far - it would be a good topic for discussion (do other OS's only have one native thread implementations? is the existing API robust enough for cooperative/work-stealing implementations? etc).
I'd missed the Dispatch class altogether until now somehow.
I was thinking the "obvious" place to plug this in is the Executors class.
e.g.
ExecutionService es = Executors.newSingleThreadedExecutor(); could reasonably be implemented internally as Dispatch.getInstance().createSerialExecutor("someName");
And if one doesn't get too hung up on the words ThreadPool in the method name
ExecutorService es = Executors.newCachedThreadPool() would map to Dispatch.getInstance().getAsynchExecutor()
But, when you read the JavaDoc for the later method in particular, its clear that the intention is that these methods return subclasses of ThreadPoolExecutor, despite the fact that they return the ExecutorService interface. In other words the API is generic but the documentation leaks implementation details...
To this end, maybe new methods in Executors like
ExecutorService es = Executors.newXXXXExecutor() where XXXX could be 'native' or 'vendor' or 'default' would make more sense as this will break no code which might otherwise downcast the ExecutorService returned from one of Executors existing methods. It would have to be paired with an SPI package so implementations could be plugged in.
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy, you can't take the sky from me)
More information about the macosx-port-dev
mailing list