As a follow up to this, here is what I did in both JVMs (actual Groovy
script, though you can see it's very similar to Java)
class Foo { }
cl = new Foo().getClass().getClassLoader()
cl.__tc_setClassLoaderName("groovy-classloader")
com.tc.object.bytecode.hook.impl.ClassProcessorHelper.registerGlobalLoader(cl);
Regarding the onload idea, that only gets called for a managed object
faulted in to the VM, so wouldn't have helped me.
Seems to me this could be a feature, along the lines of:
<named-classloaders>
<named-classloader>
<expression>groovy.lang.GroovyClassLoader$InnerLoader</expression>
<name>groovy-classloader</name>
</named-classloader>
</named-classloaders>
Taylor Gautier wrote:
I appreciate all the suggestions so far!
Tim - I am purposely trying to share a the class loaded from the
groovy loader. I understand how the approach to setting the loader
name will make this work - but let's assume for a moment I don't have
(or don't want) access to the source code, nor am I interested in
changing the groovy startup in any way.
Now what are my options - maybe I can still do the onLoad trick?
Or do some work under the hood and wire it in with a Config Module?
Tim Eck wrote:
Not sure that an on-load is what you want. Can't say for sure, but my
guess is that it isn't the loader itself that is being shared -- rather
some type from that loader becoming shared.
The other suggestions about setting the loader name and registering it
area the path to follow if types from this groovy loader must be
clustered.
The other approach is to look at what is getting shared. More often than
not, avoiding the portions of the graph don't really need to be shared can
save you from a headaches.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:tc-dev-
[EMAIL PROTECTED] On Behalf Of Geert Bevin
Sent: Wednesday, July 18, 2007 1:35 AM
To: Taylor Gautier
Cc: [email protected]
Subject: Re: [tc-dev] Groovy classloader issue
Hi Taylor,
I think you should be able to solve this with an on-load script for
the groovy.lang.GroovyClassLoader$InnerLoader class.
You should be able to call the method '__tc_setClassLoaderName' giving
it a single String argument with a unique name for the classloader.
Afterwards this will then be available for the __tc_getClassLoaderName
method.
Hope this helps,
Geert
On 18 Jul 2007, at 09:35, Taylor Gautier wrote:
I was playing with making a "groovy" class, and when I tried to
share it
I got this:
Exception thrown: java.lang.IllegalStateException: Classloader name
not
set, instances defined from this loader not supported in Terracotta
(loader: groovy.lang.GroovyClassLoader$InnerLoader)
java.lang.IllegalStateException: Classloader name not set, instances
defined from this loader not supported in Terracotta (loader:
groovy.lang.GroovyClassLoader$InnerLoader)
at java.lang.ClassLoader.__tc_getClassLoaderName(ClassLoader.java)
at
com
.tc
.object
.loaders.StandardClassProvider.getName(StandardClassProvider.java:65)
Is there an easy workaround for this, or do we need product support
for
this to work?
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev
------------------------------------------------------------------------
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev