[jboss-dev-forums] [Design of JBossCache] - Re: static field replication in PojoCache
ben.wang@jboss.com
do-not-reply at jboss.com
Tue Nov 14 01:22:18 EST 2006
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
More information about the jboss-dev-forums
mailing list