[
http://jira.jboss.com/jira/browse/JBCACHE-726?page=comments#action_12346577 ]
Ben Wang commented on JBCACHE-726:
----------------------------------
Couple points here:
1. It is possible for JBoss Aop to intercept static fields, e.g.,
class POJO{
static int field;
}
<bind pointcut="field(int POJO->field)">
<interceptor class="xxxx">
</bind>
or
<bind pointcut="field(static int POJO->*)">
<...>
</bind>
or with annotation
<bind pointcut="field(static int POJO->@XXX)">
<...>
</bind>
2. Static field's lifecycle is global scope, meaning, once it is initialized, it
won't get GC-ed. So along this line, we can say, if a static field needs replication,
during a write access, we put the static field into a global region in the PojoCache. Once
it is in, any further read access will be intercepted. And during startup, JBoss Aop will
introduce a StaticFieldInterceptor to perform interception. This is at the class level.
3. The global region can be located outside of any region. Note that this approach
won't work with buddy replication where sub-region scope is required.
PojoCache to replicate static field variable
--------------------------------------------
Key: JBCACHE-726
URL:
http://jira.jboss.com/jira/browse/JBCACHE-726
Project: JBoss Cache
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: PojoCache
Reporter: Ben Wang
Assigned To: Ben Wang
Priority: Critical
Fix For: PojoCache 2.1.0
There may be use cases that staic field variable is not final nor constant. In this case,
can we replicate that field? The problem is static variable is global scoped, so where
should we store it under? Maybe a separate area for global space, but this will break BR,
btw.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira