« Return to Thread: Interceptors and Thread safety

Interceptors and Thread safety

by ravi_eze :: Rate this Message:

Reply to Author | View in Thread

hi,

http://struts.apache.org/2.x/docs/writing-interceptors.html says that interceptors are not thread safe, i wanted a deeper understanding on this.

Case:
1. Suppose i have 2 action tags each having an interceptor (I) referenced in it
2. 2 action tags with interceptors referenced *twice in each* of them

If interceptors are not thread safe then how many instances of the objects are created in the above cases. My common-sense says 2 & 4 objects respectively.

Now,
I have an interceptor which takes data from the struts.xml in the form of params tags. The value of these param tags are held in the interceptor class's field variables. I have this interceptor included in my struts.xml as said in the case1 and 2 above. Now on concurrent requests do i get threading issues? Please clarify.

Is it thread safe if i dont put the field variables related to the internal processing of the class? i.e.. i have field variables only related to the param tags only and nothing more. Now is the interceptor thread safe?

Kindly clarify.


 « Return to Thread: Interceptors and Thread safety