[
http://jira.jboss.com/jira/browse/JBCACHE-931?page=comments#action_12378724 ]
Mircea Markus commented on JBCACHE-931:
---------------------------------------
Another refactoring approach would be using of the visitor pattern in order to support a
clearer and stronger typed way of intercepting.
(I think this is an from-manual usage of visitor pattern actually)
Each intercepted method would be a Visitable and have the following structure:
PutKeyValueMethod implements InterceptedMethod
{
accept(InterceptedMethodVisitor visitor)
{
visitor.visitPut(fqn, key, value)
}
}
Each Interceptor would be a Visitor, able to handle all intercepted operations
EvictionInterceptorVisitor implements MethodInterceptroVisitor
{
visitPut(fqn, key, value)
visitPut(fqn, attrMap)
....
}
Benefits: all the switch statements which are at the base of each interceptor would be
elegantly replaced(this includes the bunch of inner classes needed to handle those
scenarios, like in the case of EvictionInterceptors). The code would be easy to follow, as
for each intercepted method there will be an exact handling place within each
interceptor. Performance might be increased as, for example the PutKeyValueMethod might
perform a direct call to cahe.put(fqn, key, value) rather than doing it through
reflection. Extensibility would be straight forward ... and the effort of implementing it
might be reduced by the fact that code won't change, it will only move(also the task
can be done in parallel, a dev/interceptor).
I think this might be considered as an alternative to the AOP approach.
Move to JBossAOP rather than hand-wiring interceptor chain for JBoss
Cache
--------------------------------------------------------------------------
Key: JBCACHE-931
URL:
http://jira.jboss.com/jira/browse/JBCACHE-931
Project: JBoss Cache
Issue Type: Task
Security Level: Public(Everyone can see)
Affects Versions: 2.0.0.GA
Reporter: Manik Surtani
Assigned To: Manik Surtani
Fix For: 2.2.0.GA
This should be a seamless change for end-users, and backward compat should be maintained.
--
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