views:

93

answers:

3

Hi,

My Application : I have java remoting services(more then 25) on my (Tomcat BlazeDS)server which are called from my Flex client application.

My Requirment : I need to collect stats on them like how much time each service is taking(total time).

There are three approaches I can do this in my opinion(may be more)

1) change each service and add timer at beginning and ending. --- bad practice 2) I can also use AOP but I feel its an over kill for this requirement. --- over kill 3) servlet Filter. ---- Good option

   I really like option three but I am not sure how to do this with BlazeDS. Can it be done and if so any example/direction would be great.

thank you

A: 

I use a servlet filter to do this in my Census app. You can find the filter code on sourceforge.

James Ward
But how can I get the service name in the filter servlet ?
firemonkey
That is probably a bit harder. I use special request parameters that I can easily read out. But you might have to pull apart the AMF response to get more details into what the service name is.
James Ward
A: 

In order to use the ServletFilter it will need to deserialize the raw HTTP request content from AMF into a graph of Java objects. If you can find an instance of AsyncMessage in the graph you can examine its "destination" property which maps directly to the service in question. It looks like you could use the MessageDeserializer from the BlazeDS APIs to do this but it also depends on some other objects to work.

Are you using Spring? If so, doing this with AOP is very easy.

cliff.meyers
A: 

Hi,

 I have found the solution :

I extend JavaAdaptor and in invoke method, I can get destination name and total time.

thank you

firemonkey