So where is vertx going to load classes from when it creates this new class loader ?
If you're going this route maybe just have it accept a classloader ?
vertx.deployVerticle(String, ClassLoader);
This would allow people to do a lot of things. You could even download the verticle :)
On Thursday, April 24, 2014 8:45:16 AM UTC-4, Tim Fox wrote:The proposal to remove the module system and consequently the
classloader isolation in Vert.x 3.0 seems to have split people.. Some of
you would love to see it go in order to simplify things and others
really like the feature...
So, how about a compromise...
Let's say you do
vertx.deployVerticle(verticleClass)
By default this will simply run the verticle using the current
classloader - i.e. we have a single flat classpath in the application.
But if you want your verticle to be deployed isolated, then you can do
something like:
vertx.deployVerticle(verticleClass, isolated = true);
Then it will create a new classloader and instantiate the verticle using
that, and any other libraries loaded by that verticle will also be
loaded by that new classloader. So basically that verticle and anything
else it instantiates will live in its own new flat classpath.
That way we can remove the module system but still retain classloader
isolation, if required.
How does that sound?
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
How does that sound?
--
--
I’m not opinionated on either vert.x should have two or more modes but I especially would highlight api retrocompatibility. It is really important to keep that in mind. retro-compatibility (API and behavioral wise) is not overrated !
Also I would not favor API proliferation, with additional method overloads, etc. What if there was other parameters to pass in vert.x 4, 5, 6, etc.
In mockito for example we have normal verification and we created a special verifier implementation for ordered verification, on which you can call the exact same methods, in other places we also have strategies (VerificationMode, Answer), or spec object (MockSettings). Rx uses the same style of API to create an Observable. So let’s promote this kind of API. For example iterating over the API that Dean Pehrsson-Chapman proposed :
vertx.deployVerticle(verticleClass); // same behavior as vert.x 2.x => deploy with classloader isolation
vertx.isolating().deployVerticle(verticleClass); // deploy with classloader isolation
vertx.isolating(withCurrentCLParent()).deployVerticle(verticleClass); // deploy with classloader isolation and current CL as parent
vertx.isolating(usingCustomCLMaker()).deployVerticle(verticleClass); // deploy with classloader isolation using a custom classloader factory
vertx.flat().deployVerticle(verticleClass); // deploy in the same CL
Of course this kind of API could be tweaked in a different ways. And could be reused for other part of the API to enable additional features.
Thoughts ?
Rather then trying to enum the permutations, how about just creating a VerticleGroup concept that incorporates a shared ClassLoader eg
vertx.deployVerticle(class)vertx.deployVerticle(class,group)
this way you don't allow custom classloaders, but the deploying master verticle can define isolation groups that match their requirements. it could also be used to assign other resources (eg each group could have its own workerverticle threadpool) that might also need to be configured independently for third-party verticles.
nb still wondering if the problems people have with classloaders are because they are trying to share / compare instances inside the VM. since that's bad practice, won't work in a cluster etc, perhaps the default should be still be isolated classloader (per verticle class) with the option to share the classloader available only for those who need it?
-Peter
On Friday, 25 April 2014 07:52:22 UTC+1, Dean Pehrsson-Chapman wrote:How about:
vertx.deployVerticle(verticleClass, ClassloaderIsolation.FLAT) ;vertx.deployVerticle(verticleClass, ClassloaderIsolation.ISOLATED);vertx.deployVerticle(verticleClass, ClassloaderIsolation.ISOLATED_INCLUDE_CURRENT);vertx.deployVerticle(verticleClass); //default - ClassloaderIsolation.FLAT
I think that would give all the functionality we currently have (but people would need to be explicit about it), and stops people using their own wonky classloaders and expecting you to support.
--
Are these assumptions correct? If the module system goes away, with it goes mod.json, the ability to include the resources of other modules, the module registry, automatic installation of modules...
I thought that one of the strengths of the module system, is the ability to provide functionality for others to use, irrespective of the programming language it is written in.
Now, what happens in a world without Vert.x modules? Will a JavaScript developer have to use gem to install a Ruby verticle? (Will this be possible at all?) Will a java developer have to learn npm if he is interested in functionality provided today by a JavaScript module? Will reuse on the level of todays modules still be easy?
Or will we have a Vert.x Java community, a Vert.x JavaScript community...
Please explain.
Am Donnerstag, 24. April 2014 14:45:16 UTC+2 schrieb Tim Fox:The proposal to remove the module system and consequently the
classloader isolation in Vert.x 3.0 seems to have split people.. Some of
you would love to see it go in order to simplify things and others
really like the feature...
So, how about a compromise...
Let's say you do
vertx.deployVerticle(verticleClass)
By default this will simply run the verticle using the current
classloader - i.e. we have a single flat classpath in the application.
But if you want your verticle to be deployed isolated, then you can do
something like:
vertx.deployVerticle(verticleClass, isolated = true);
Then it will create a new classloader and instantiate the verticle using
that, and any other libraries loaded by that verticle will also be
loaded by that new classloader. So basically that verticle and anything
else it instantiates will live in its own new flat classpath.
That way we can remove the module system but still retain classloader
isolation, if required.
How does that sound?
--
jars sounds like an extra learning curve in and of itself to me.
Norman MaurerSame here…
Well, I tried to respond to you and explain why it would make life more difficult, but I kind if grew fond of the idea in the process and deleted my response after I realized it was stupid.