It is still not as fast as it could be (since classes are not cached).
I have a branch where ResolveManager2 is under construction and testing:
- https://github.com/jive/uDig/tree/resolve
If you like you can pull that down and kick the tires; I started from the
design of AdapterManager and have been cleaning it up with generics and making
use of
a proper ResolveAdapterFactoryProxy that can answer many questions without
loading the actual factory.
The real trick AdapterManager performs is caching the full set of super classes
and supported interfaces for a given class, so it has a faster alternative to
instance of checks. I suspect when this change is rolled out our implementation
will be much more predictable.
--
Jody Garnett
On Thursday, 30 August 2012 at 7:46 AM, Emily Gouge wrote:
> Thanks Jody - I was able to get this update and confirm that it works.
>
> On 8/28/2012 9:04 PM, Jody Garnett wrote:
> > > If you comment out the first try/catch section of that function (which
> > > is supposed to "optimize" the code), the performance improves.
> > >
> >
> >
> > I added a check so the "optimisation" is only attempted for non "udig" code.
> > > String resolveType=child.getAttribute("type"); //$NON-NLS-1$
> > > if( !resolveType.startsWith("net.refractions") &&
> > > !resolveType.startsWith("eu.udig") ){
> > > // We first try a class loader trick to grab the target class
> > > // without forcing the load of the plugin where the element
> > > // comes from (this works in may cases where the type is something
> > > // common from net.refractions.udig.libs)
> > > try{
> > > ClassLoader classLoader = target.getClassLoader();
> > > if( classLoader==null ){
> > > classLoader=ClassLoader.getSystemClassLoader();
> > > }
> > > Class< ? > resolvedClass = classLoader.loadClass(resolveType);
> > >
> > > if( target.isAssignableFrom(resolvedClass) ){
> > > return true;
> > > }
> > > else {
> > > continue; // we were able to load the class and it did not match
> > > }
> > > } catch(ClassNotFoundException e2){
> > > // that is no good, let's try using the RCP classloader
> > > }
> > > }
> > >
> >
> >
> >
> >
> > It has restored performance. I will continue on with the more detailed
> > solution; but for now we are in position to release again.
> >
> > Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel