struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoying, Ken" <Ken_Hoy...@PremierInc.com>
Subject RE: [S2] Interceptor Question (Thread Safety)
Date Mon, 09 Jul 2007 13:01:51 GMT
Thanks, Rene!

Someone might want to update the documentation to make this clearer.
The following document seems to indicate otherwise:

http://struts.apache.org/2.x/docs/writing-interceptors.html

Thread Safety
	Interceptors must be thread-safe!

A Struts 2 Action instance is created for every request and do not need
to be thread-safe. Conversely, Interceptors are shared between requests
and must be thread-safe.  

-----Original Message-----
From: Rene Gielen [mailto:gielen@it-neering.net] 
Sent: Sunday, July 08, 2007 7:00 AM
To: Struts Users Mailing List
Subject: Re: [S2] Interceptor Question (Thread Safety)

Ken,

there is no problem at all since s2 interceptor instances, as well as
action instances, are created per ActionInvokation, which means they are
always operated in a single thread.

Regards,
Rene

Hoying, Ken schrieb:
> From what I understand from reading the documentation, interceptors 
> are suppose to be thread safe.  However, I have noticed that some of 
> the interceptors do  contain instance variables and I have seen some 
> examples where these variables are set or modified from with in the 
> action configurations.
> 
> For example, the File Upload interceptor allows you to set the 
> maximumSize and allowedTypes.  Is this going to work if I have 2 
> different actions each allowing different maximumSize and
allowedTypes?
> This does not seem thread safe to me.  Is there only one instance of 
> the interceptors or does maybe each action mapping have its own 
> instance of the interceptors?
> 
> Thanks in advance,
> Ken
> 
> 
> 
> -----------------------------------------
> ***Note:The information contained in this message may be privileged 
> and confidential and protected from disclosure. If the reader of this 
> message is not the intended recipient, or an employee or agent 
> responsible for delivering this message to the intended recipient, you

> are hereby notified that any dissemination, distribution or copying of

> this communication is strictly prohibited. If you have received this 
> communication in error, please notify the Sender immediately by 
> replying to the message and deleting it from your computer. Thank you.

> Premier Inc.


--
Rene Gielen  | http://it-neering.net/
Aachen       | PGP-ID: BECB785A
Germany      | gielen at it-neering.net

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message