Modularizing URLStreamHandlerFactory

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 18 06:15:03 PDT 2012


On Jun 18, 2012, at 2:29 PM, David Holmes wrote:

> On 18/06/2012 6:49 PM, Paul Sandoz wrote:
>> On Jun 18, 2012, at 3:20 AM, David Holmes wrote:
>>> On 16/06/2012 7:17 AM, Jesse Glick wrote:
>>>> Something to consider - in a big application it is not uncommon to have
>>>> multiple URL handlers implemented in various places. Yet the JRE only
>>>> lets you set a single URLStreamHandlerFactory for the whole JVM. So for
>>>> the application to be modular, you need to write a proxy factory which
>>>> accepts modular registrations, but that impedes interoperability since
>>>> you must define a proprietary interface for this.
>>>> 
>>>> It would be nicer for a modular JRE to allow URL handler factories to be
>>>> registered as services. OSGi and the NetBeans module system both do
>>>> something like this.
>>>> 
>>>> Similar arguments could perhaps be made for other pluggable singletons
>>>> in the current Java platform API (UncaughtExceptionHandler, FileNameMap,
>>> 
>>> When we added UncaughtExceptionHandler we recognized the desirability to have a "per app" default rather than only having the global default, but there was/is no "application context" to define-in or extract-from the UEH. I don't see how a modular JRE has changed that at all?
>> 
>> A modular JRE might not change that but a module *system* can. The "application context" is the configuration, the thing that is pre-calculated (currently at install time) for an application module (one that uses the "class" clause e.g. "class foo.Main").
> 
> If a configuration represents a single running instance of the VM then it isn't adding anything to the existing global default UEH situation - other than perhaps a more flexible way of establishing that global default.
> 

Sorry, i am being a little obtuse with the above. A configuration is associated with an application. Currently the Jigsaw module system supports one application running per VM. For multiple applications, that are to some degree isolated from each other, the Jigsaw module system requires (the yet to be defined and implemented) container support, previously mentioned by Alan.

Paul.


More information about the jigsaw-dev mailing list