[jboss-user] [JBoss Microcontainer Development] New message: "Re: Native library mapping at jboss-cl level"
Adrian Brock
do-not-reply at jboss.com
Thu Jan 21 09:27:46 EST 2010
User development,
A new message was posted in the thread "Native library mapping at jboss-cl level":
http://community.jboss.org/message/521436#521436
Author : Adrian Brock
Profile : http://community.jboss.org/people/adrian@jboss.org
Message:
--------------------------------------------------------------
> mailto:thomas.diesler at jboss.com wrote:
>
> jboss-cl http://fisheye.jboss.org/changelog/JBossAS/projects/jboss-cl?cs=99732
>
> I added http://fisheye.jboss.org/browse/JBossAS/projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java?r=root:to http://fisheye.jboss.org/browse/JBossAS/projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java?r=root: wich gets initialized by http://fisheye.jboss.org/browse/JBossAS/projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java?r=root:.
> At resolve time, the http://fisheye.jboss.org/browse/JBossAS/projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java?r=root: adds NativeLibraryProvider instances to the http://fisheye.jboss.org/browse/JBossAS/projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java?r=root:
> which are accessed by the http://fisheye.jboss.org/browse/JBossAS/projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java?r=root: like this
>
I tidied up your commit a bit.
1) The NativeLibraryProvider should be a top level interface since it is a public spi.
2) I made the map in the ClassLoaderPolicy thread safe, i.e. I made it volatile and used locals to get a consistent view.
The way you had it, one thread could continue to see it as null for some time after another thread sets it.
3) I made the getNativeLibraries() method return an UnmodiableSet so that callers can't modify the map in unpredicatble ways.
Some things that still need looking at:
1) Why are the getters public and what are they for? I'm a bit worried that somebody could use this api to find out the location
of the native code and overwrite the file with their own dodgy code. :-)
2) I don't see any use of NativeLibraryProvider, but I am guessing you are not doing it correctly?
They should be constructed against the ClassLoading Module and it (they) should be what initialises the ClassLoaderPolicy.
3) What's the point of the metadata in the base code if there is nothing that actually uses it? I expected to see something like a
NativeLibraryProviderFactory on the ClassLoading object, which the Module then uses to turn the MetaData into Provider(s).
You could create a default one that just copies the library into ${java.io.tmpdir}, although if that is a shared temporary directory,
its not a good place to put code. ;-)
4) The xml parsing (including the xsds) and managed object annotations need adding and testing.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/521436#521436
More information about the jboss-user
mailing list