Github user MattWhelan commented on the pull request:
https://github.com/apache/spark/pull/4165#issuecomment-71105198
@vanzin
The way the registration method works is also really weird. It takes no
params, you'll notice. In ClassLoader, it calls a Reflection native method to
actually get a reference to the *caller's* Class. Which feels all kinds of
horrible to me, though it does make for a really simple interface (in Java).
But, the upshot is that registerAsParallelCapable() must be called from the
class being registered, before an instance of that class has been created. So
basically, a static initializer.
Since there aren't real static methods in Scala, I don't think the factory
thing would work. Even though you could probably get the timing right, the next
level down the stack would be a companion object class, or something, not the
CL itself.
Really, I'm pretty OK with that. ClassLoaders and all their related issues
are deep JVM voodoo. It's a low-level concept, and Scala is a high level
language.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]