While trying to implement http session replication (field level granularity), 
the need arises to listen for an object level event since we will need to 
update the timestamp, for example.

I thought such event listering mechanism will also be useful for others as 
well. Let's say if a field has been updated, users will be interested to know 
about it and its associated object. So I am thinking to design it like a 
TreeCacheAop listener.

Idea is to add a dynamic interceptor (of type EventInterceptor, for example) 
right after CacheInterceptor. So whenever, a field is accessed (get/set), it 
will go through the event interceptor. If the listener stack is present, it 
will invoke the call back to the listeners. But if there is no listener 
present, the overhead is the empty interceptor of which I think the performance 
penalty should be minimal.

There is also the question of the Event object that get passed around. It will 
have information of the invoked object, the field access, and the access type 
(get or set).

If a user wants to become a listener, it will implement the interface of 
course. Then the cache client code will need to do addObjectEventListener api 
to add the listener.

Internally, the method addOjectEventListener(Object pojo, Listener listener) 
will add an EventInterceptor (after the current CacheInterceptor) that calls 
out to listener. This method can be called multiple times. Pre-condition is 
pojo is of class type "Advised" and CacheInterceptor has already been added.

Any other suggestion is welcome.

-Ben


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865145#3865145

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3865145


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to