[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBMESSAGING-1225 - PacketFilters implementation
apwalker
do-not-reply at jboss.com
Tue Jan 29 06:48:50 EST 2008
| public class DummyFilter implements PacketFilter
| {
| public boolean filterMessage(AbstractPacket packet, PacketHandler handler,
| PacketSender sender)
| {
| System.out.println("Packet " + packet + " intercepted);
| return true;
| }
|
| }
|
IMHO you should use a Packet interface rather than the AbstractPacket as the type that get passed in. I guess so should PackHandler and PacketSender if they aren't already.
Is the fact that you return a boolean does this signal the invocation to proceed? More traditional interceptor design would be if you want to stop the execution flow you throw an Exception in the interceptor. For example a custom security servlet filter would throw a SecurityException. It better to do this because then what was originally called can know why the invocation was halted.
Feel free to ignore my humble rants... but I do like nice clean APIs and once you have one customer who's written a Filter you will never be able to change it again..... :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124356#4124356
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124356
More information about the jboss-dev-forums
mailing list