[jboss-dev-forums] [Design of JBossCache] - Re: static field replication in PojoCache
bela@jboss.com
do-not-reply at jboss.com
Sun Nov 12 09:50:18 EST 2006
"ben.wang at jboss.com" wrote :
|
| I introduced that field annotation (@Replicatable) becuase I reckon there may be a case I don't want to replicate 1) any of the POJO static variables at all (this is happening most often); or 2) all of my static variables, e.g.,
|
|
| | org.jboss.cache.pojo.annotation.PojoCacheable
| | public class POJO
| | {
| | @org.jboss.cache.pojo.annotation.Replicatble
| | public static int someStaticVar;
| |
| | public static int anotherStaticVar; // this one won't get replicated.
| | ...
| | }
| |
|
|
I think this is not intuitive: @PojoCacheable replicates *all* variables, so static vars should be included.
You can exclude static vars using the transient keyword or @transient annotation.
anonymous wrote :
| anonymous wrote : #2 Of course we need to support another static variable ! Ideally we adhere to the Java semantics
|
| Sure, it will be supported. I meant in my originally post that we won't support a static variable of "aspectized" POJO type, e.g.,
|
| | org.jboss.cache.pojo.annotation.PojoCacheable
| | public class Foo
| | {
| | ...
| | }
| |
| | org.jboss.cache.pojo.annotation.PojoCacheable
| | public class POJO
| | {
| | @org.jboss.cache.pojo.annotation.Replicatble
| | public static Foo someStaticVar; // we cant support that someStaticVar is of type Foo of which is PojoCacheable.
| | ...
| | }
| |
|
| Reason? Well, static variable is usually initialized failry early in the program lifecycle. So support of another POJO type to be managed by the PojoCache can be troublesome. I imagine mostly the static type to be primitive. Or am I assuming too much?
|
Can we at least try before we give up ? :-) I don't (currently) see why static vars should only be of primitive types... So, okay, we can create those instances but only replicate them once we have been fully initialized.
anonymous wrote :
| anonymous wrote : #5 Why ? we can have N someStaticVars per *cluster*...
|
| Now I don't get you. If someStaticVars is replicated, then there can only be a someStaticVar per *cluster* (sure, different VM will have their own instances). I was proposing to allow inside each VM, only one PojoCache instance is allowed to have static variable replication. Elias' discussion is also focused on this area as well.
|
Why should only 1 PojoCache be allowed to have static var replication inside the same VM ? This sounds like an arbitrary restriction...
anonymous wrote :
| Finally, on the naming of @PojoCacheable instead of @Clustered or @Replicated. I have thought about that before. I think @Clustered or @Clusterable is not appropriate becuase we are talking about state replication only (i.e., no client side load balancing).
|
| As for @Replicated, it is possible. But the expectation will be different. E.g., a user should not expect that once the Pojo is annotated and instantiated, then thing will happen automatically. That is, we are not using the API-less model; we still need to have api to *attach* the POJO. So @Replicated tag is a bit overloaded, IMO.
|
Still much better than @PojoCacheable, which is horrible
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985215#3985215
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985215
More information about the jboss-dev-forums
mailing list