[JBoss AOP] - Write invocation not being called for arrayreplacement
by sgoyette
Hi All,
I've been pulling my hair out with this one for some time. I'm trying to intercept reads and writes to an array. Reading is working really well but I cannot for the life of me get the writes to work. Here's is mu jboss-aop.xml file:
| <?xml version="1.0" encoding="UTF-8"?>
| <aop>
| <interceptor class="com.intuit.tax.engine.group.TSingleGroupInterceptor"/>
|
| <arrayreplacement class="com.intuit.tax.engine.group.TSingleGroup" />
| <prepare expr="field(* com.intuit.tax.engine.group.TSingleGroup->R)"/>
| <prepare expr="field(* com.intuit.tax.engine.group.TSingleGroup->B)"/>
| <prepare expr="field(* com.intuit.tax.engine.group.TSingleGroup->S)"/>
|
| <arraybind type="READ_WRITE">
| <interceptor-ref name="com.intuit.tax.engine.group.TSingleGroupInterceptor"/>
| </arraybind>
| </aop>
|
This calls this function within the TSingleGroupInterceptor:
| public Object invoke(Invocation invocation) throws Throwable {
|
| List<ArrayReference> refs = ArrayRegistry.getInstance().getArrayOwners(invocation.getTargetObject());
| logger.debug("Owner is " + refs.get(0).getRootObject().getClass().getName() );
|
| // These objects should only have a single owner
| TSingleGroup group = (TSingleGroup)refs.get(0).getRootObject();
| if ( invocation instanceof ArrayElementReadInvocation) {
| logger.debug("Read invocation");
| return invoke((ArrayElementReadInvocation) invocation, group);
| } else if (invocation instanceof ArrayElementWriteInvocation) {
| logger.debug("Write invocation");
| return invoke((ArrayElementWriteInvocation) invocation, group);
| }
| logger.debug("No match for read/write. Invocation is: " + invocation.getClass().getName() );
| throw new RuntimeException("This interceptor is for arrays");
| }
|
Write invocation is never logged and neither is "No match for read/write".
What am I doing wrong? Can anyone help?
Thanks,
Steve
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222717#4222717
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222717
15 years, 9 months
[JBoss Cache: Core Edition] - Re: JPA/Hibernate JBC usage
by zeravlai
Ooops I forgot another couple of questions:
- I'm testing the cache with PESSIMISTIC and both RR and RC.
- I understood from Manik that RC does not make any sense since hibernate session provides RR.
- But according to the document you pointed me to (hibernate-jbc), "pessimistic locking with REPEATABLE_READ will cause a write to block if there is a concurrent transaction which holds a read lock, till the read transaction commits".
I tested the following which leads me to a different interpretation.
- T1 and T2 reads an entity which has been previously cached. T2 starts slightly after T1.
- T1 then just waits ..... and T2 modifies a field of the read entity and commits (I see the cache and db updated).
- Then after a while T1 prints the same field T2 modified, and commits.
The two reads of T1 reports the same value (this is consistent with RR policy) but I don't see T2 blocking till T1 commits, which according to the document should be the case if OPTIMISTIC is used.
I'm sure I'm missing something "again" ;-) .
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222716#4222716
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222716
15 years, 9 months