Regarding this article http://docs2x.smartfoxserver.com/ExtensionsJava/advanced-concepts under section "Class loading architecture" on the picture there is extension class loader shown specific gfor each extension.
For contenxt: im using org.reflections library to query available classes and find classes that i need.
Project is divided into multiple modules and in each module i have dummy class, so i can get the reference to that module classes through classloader.
Whem im instancing org.reflections library im passing that dummy classes to it and it seems to work fine until i have multiple extension running.
And it seems that im only able to find classes that was loaded last as far as i know because classloader keeps the last version of class if it finds duplicates.
For example: if i have zone A and zone B both running exact same extension jar build and zone B will initialize last - org.reflections library will find zone B classes when extensions ran.
It seems to me that for some reason im passing "global" extension class loader and that why it can find classes of zone that was loaded last.
Im wondering - how can i get a reference to specific zone classloader? So each time org.reflections library is used it will query its extension classes.
How to get reference to extension level class loader?
Re: How to get reference to extension level class loader?
Hi,
I am not familiar with this org.reflection library. The JDK already provide this feature, are you referring to the native Java reflection, perhaps?
Also it's not very clear what you're trying to accomplish and why doing it via reflection, which is pretty slow and complicated to use with multiple class loaders.
Thanks
I am not familiar with this org.reflection library. The JDK already provide this feature, are you referring to the native Java reflection, perhaps?
Also it's not very clear what you're trying to accomplish and why doing it via reflection, which is pretty slow and complicated to use with multiple class loaders.
Thanks
Re: How to get reference to extension level class loader?
I'm reffering to this reflections library https://mvnrepository.com/artifact/org.reflections/reflections
I'm trying to make use of simple di container that i wrote, which works with Reflections (kinda similair to Spring, just bare bones), im marking my services with annotation to bind them in container.
Reflection is only used at startup, so it doesnt really affect performance.
Strangest thing is that everything worked already flawlessly right before ive decided to split project into different modules.
When everything was in single module - reflections works fine, ive just instantiated this library without any dummy classes and it worked as intended (means loading classes from extension where archive was deployed).
I'm trying to make use of simple di container that i wrote, which works with Reflections (kinda similair to Spring, just bare bones), im marking my services with annotation to bind them in container.
Reflection is only used at startup, so it doesnt really affect performance.
Strangest thing is that everything worked already flawlessly right before ive decided to split project into different modules.
When everything was in single module - reflections works fine, ive just instantiated this library without any dummy classes and it worked as intended (means loading classes from extension where archive was deployed).
Who is online
Users browsing this forum: No registered users and 107 guests