[Design of JBossCache] - Re: static field replication in PojoCache
by ben.wang@jboss.com
OK, let me try to propose from step 1 again on a newer approach after collecting these feedback. Let's first list the example POJO though:
| public class POJO
| {
| public static int someStaticVar;
|
| @Transient
| private static int anotherStaticVar;
|
| ...
| }
|
1. static field replication is on by *default*. If a user wants to turn it off, he can annotate it with @Transient tag as in the above code snippet.
2. There will be no new API introduced. Instead, we will rely on the usual POJO attach/detach to trigger static field replication. E.g.,
| ...
| // First attach will trigger static field replication as well.
| cache.attach("id", pojo);
| ...
| cache.someStaticVar = 20; // This will get replicated.
|
| // last attach will remove the static field.
| cache.detach("id");
|
2a. Again we will store the static variable under a special area, /__JBoss_Static__/.
2b. We will do reference counting to keep track of how many POJO there are associating it (such that we know when to remove the replicated static field).
I think this is much cleaner approach. What do you think?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985706#3985706
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985706
19 years, 5 months
[Design of POJO Server] - Re: @JMX aspect and aop/mc integration
by bstansberry@jboss.com
Tweaking JMXIntroduction so it just directly registered my beans worked just fine. The problem is there is no way to cleanly express that that's what I want done:
1) JMXIntroduction could just try to register context.getTarget(), catch NotCompliantMBeanException, and then create and register the StandardMBean. Problem is this approach ignores the @JMX.exposedInterface value -- what if the bean is Foo implements FooMBean, Bar, and @JMX.exposedInterface=Bar.class? Kind of an edge case, but not clean.
2) JMXIntroduction could try to register context.getTarget() only if @JMX.exposedInterface=null. This would be a clean solution. Problem is null is not a valid value for an annotation attribute, and the attribute type is Class, so you can't use the "" means null trick. (Hacky idea -- make it "Class exposedInterface() default void.class". The compiler accepts that.)
3) I tried adding another attribute "boolean registerDirectly() default false;" to @JMX. But the deployment of any beans where it didn't specify the attribute failed in SimpleAnnotationValidator, which makes no attempt to read default values.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985698#3985698
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985698
19 years, 5 months