[Design the new POJO MicroContainer] - Class metadata scope doesn't understand classloaders
by adrian@jboss.org
There's a problem with the metadata repository and the class scope.
The issue is that it uses a String to identify the class
so two different classloaders with the same class will clash.
I'm changing the scope qualifier to be an Object such that
the class scope can do:
scopeKey.addScope(new Scope(CommonLevels.CLASS, theClass);
which will form a unique key across classloaders.
As part of the work I'm introducing a new MetaDataRetrievalFactory
which can be installed on the repository.
I'm adding a class factory by default to the Base implementation
so we no longer have to maintain the class scopes in the repository,
just reference them from scope key as above.
e.g. the deployer scope test no longer has to maintain the class
scope in the deploy/undeploy.
This creates a problem for the MC, where it doesn't know the classloader
until PreInstall. I don't really know how to fix this cleanly, instead
I've hacked the KernelScopeInfo to replace the string version of the scope
(the string is known from the xml) to the class loaded from the bean's classloader.
|
| @Override
| public ScopeKey getScope()
| {
| // THIS IS A HACK - the scope originally gets initialise with a class name, we fix it to have the class
| ScopeKey key = super.getScope();
| Scope scope = key.getScope(CommonLevels.CLASS);
| if (scope == null)
| return key;
| Object qualifier = scope.getQualifier();
| if (qualifier instanceof Class)
| return key;
|
| String className = (String) qualifier;
| ClassLoader cl = null;
| try
| {
| cl = Configurator.getClassLoader(beanMetaData);
| }
| catch (Throwable t)
| {
| throw new RuntimeException("Error getting classloader for " + key, t);
| }
| Class<?> clazz = null;
| try
| {
| clazz = cl.loadClass(className);
| }
| catch (ClassNotFoundException e)
| {
| throw new RuntimeException("Unable to load class: " + className + " for " + key, e);
| }
| key.addScope(new Scope(CommonLevels.CLASS, clazz));
| return key;
| }
|
Further I added some convience methods for the component metadata
(ComponentMutableMetaData) so you can do things like
memoryMetaDataLoader.addAnnotation(method(info), myAnnotation);
While I was there I tidied up some of the Signature uses.
There are now easy mechanism to create one from a MethodInfo, etc.
The last also avoids some unnecessary multiple converion of parameter types
that was happening.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106363#4106363
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106363
18 years, 4 months
[Design of JBossCache] - Re: TimeoutException printing stacktraces of threads holding
by galder.zamarreno@jboss.com
"jason.greene(a)jboss.com" wrote : IMO adding deadlock detection would probably help reduce the need for all the logging.
Hmmm, I'm not sure whether we're in the same page here. Let me explain:
When you get a TE, you get a stacktrace of the Thread trying to acquire the lock. If you wanna find out what the thread(s) holding the lock are doing, you have to:
1.- Enable %t in the logging pattern so that you can figure out what each thread is logging.
2.- Add trace for cache and any other application that might be using the cache, i.e. portal, hibernate, ejb3....etc
3.- Ideally, you want the customer to provide a stacktrace so that you can see where the calls are coming from. This is specially useful in situations where projects hardly have any debug or trace logging, i.e. ejb3, portal.
1 and 2 are easy to get. 3 can be a bit trickier and depends on user timing. With this post, I'm trying to make 3 more predictable.
Jason, from what I understand, a TE might not be always related to a deadlock. It could just be that the other thread is being slow.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106345#4106345
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106345
18 years, 4 months
[Design of JBoss jBPM] - Improvig timer
by camunda
Hi!
I was at a customer last week and they implement an improved timer for themselves. And I saw that requirement already many times, normally it was solved by own written ActionHandler. But to have an advanced timer would be even nicer!
I am not sure if it gets already more powerful with the PVM?
Here the requirements: They want the timer to be due on some specific time on a certain day. The hacked the Calendar and can now configure the timer like this:
| <timer name="uniquetimername1" duedate="07.11.2007-17:32:00 timestamp" transition="toNextNodeAfterTimer"></timer>
|
Maybe this can be easily improved to
| <timer name="xyz" duedate="today+1-17:32:00 timestamp" transition="whatever"></timer>
|
with the new unit, they can just parse the duedate differently. This apporach is OK, but has the weekness, that it cannot really be combined with the business calender (e.g. 3 business days, but 09:00).
If we can agree on a good format to support this, they would give me the appropriate code so I can commit it. But what format?
I think best solution would be to add an attribute, so we get
| <timer name="xyz" duedate="1 business day" time-constraint=">19:00" date-constraint="=20.11.2007" transition="whatever"></timer>
|
By the way: duedate and the new attributes should be able to read expression language.
Thought?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106335#4106335
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106335
18 years, 4 months