Re: concurrency in struts

2004-05-10 Thread Jignesh Patel
So you mean to say that there should not be any class variable used?

But even though there are more then one thread executing execute method then?
There is a possibility that for one thread 2 parameters will be filled and for 
other thread remaing 3. So all parameters are having different values from 
two different users while it stores for only one user.

I appologize if I am going to very basic!

-Jignesh
On Monday 10 May 2004 18:36, Daniel Perry wrote:
 Each request to the same action subclass uses the same object.  The method
 is called passing all necessary parameters to it.  Therefore you should not
 use any class variables, only local variables.

 Ie, a MyAction class is created once, and for each request to it, it's
 method is called:

 public ActionForward execute(
   ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)

 This object is retained throughout application lifecycle, and reused for
 each request.

 Daniel.

 -Original Message-
 From: Jignesh Patel [mailto:[EMAIL PROTECTED]
 Sent: 10 May 2004 14:04
 To: Struts Users Mailing List; Geeta Ramani
 Subject: Re: concurrency in struts


 Hi Geeta,
 Can you elaborate more?

 -Jignesh

 On Monday 10 May 2004 18:18, Geeta Ramani wrote:
  Jignesh:
 
  The execute method of the Action class includes (among others) as
  params the request, response objects of each user.. That I believe is the
  key..:)
 
  Regards,
  Geeta
 
   -Original Message-
   From: Jignesh Patel [mailto:[EMAIL PROTECTED]
   Sent: Monday, May 10, 2004 8:54 AM
   To: Struts Users Mailing List
   Subject: concurrency in struts
  
  
   On Monday 10 May 2004 17:21, Jignesh Patel wrote:
I am just wondering, how concurrent request will be handled by single
Action class. Because for many form objects(as there are thousands of
browser running with jsp forms) and there is only one action class.
  
   --
   Jignesh Patel
   Project Leader
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 --
 Jignesh Patel
 Project Leader
 
 Bang Software Technolgy Pvt. Ltd.


  (E) [EMAIL PROTECTED]

  (T) 091 484 3942132


  B-4, Smart Business Centre,
  Infopark, SDF IT Building,
  Kusumagiri P.O.,Kakkanad,
  Kochi - 682030,
  Kerala,
  India.

  Information contained in this transmission to the named  addressee,
 including
 any attachments thereto, should be
  considered the proprietary and confidential information of the sender.  As
 a
 condition for viewing the information,
  the sender agrees to keep the information confidential, to  refrain from
 disclosing the information, directly or
  indirectly, and to refrain from any actions that would  constitute or
 facilitate unauthorized access to the
  information without express permission from the sender. The recipient also
 acknowledges and agrees to respect
  sender's intellectual property rights in and to the  information.  If the
 recipient of this transmission is not
  the named addressee, the recipient should immediately notify the sender
 and destroy the information transmitted
  without making any copy or distribution thereof.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Jignesh Patel
Project Leader

Bang Software Technolgy Pvt. Ltd.

 
 (E) [EMAIL PROTECTED]

 (T) 091 484 3942132


 B-4, Smart Business Centre,
 Infopark, SDF IT Building,
 Kusumagiri P.O.,Kakkanad,
 Kochi - 682030,
 Kerala,
 India.

 Information contained in this transmission to the named  addressee, including 
any attachments thereto, should be
 considered the proprietary and confidential information of the sender.  As a 
condition for viewing the information,
 the sender agrees to keep the information confidential, to  refrain from 
disclosing the information, directly or
 indirectly, and to refrain from any actions that would  constitute or 
facilitate unauthorized access to the 
 information without express permission from the sender. The recipient also 
acknowledges and agrees to respect
 sender's intellectual property rights in and to the  information.  If the 
recipient of this transmission is not
 the named addressee, the recipient should immediately notify the sender and 
destroy the information transmitted
 without making any copy or distribution thereof. 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL

Re: concurrency in struts

2004-05-10 Thread Manfred Wolff (neusta)
There are two concepts you have to understand: thread-safe and reentrant.

A method is reentrant, if many threads can enter the method as the same 
time without conflicting. For that you only have to act on parameters 
and local variables. Threads only share the data- and the code-segment 
of an application. Every thread gets his own stack-segment, where all 
local variables and the parameters will be push onto. If you act in the 
execute-method only on the parameters and on local variables you are 
thread safe. If you will join shared ressources as database connections 
... you have to take care, that such ressources are either pooled or the 
access is sychronized.

So the message is: In the execute Method don't use global variables but 
only local variables. This and the parameters are pushed on your stack, 
that is only in your thread visible.

Hope it helps
Manfred Wolff
Jignesh Patel wrote:

Riyad,
But does this methods are synchronized? Otherwise if two threads execute at 
the same time they can access the method at the same time. And result will be 
big mess.

-Jignesh
On Monday 10 May 2004 18:29, Riyad Kalla wrote:
 

This question is actually what made me sign up to this mailing list...
the answer is that there is no implicit concurrency. All your
work/variables in Actions should be method-scoped and not use ANY class
variables because of this. My specific questions was that I wanted to
use a class variable ActionErrors so any of my methods
(DispatchAction) could add errors without initializing a new ActionError
instance, and return it. But this is incorrect and can/will introduce
problems.
So there is no concurrency in Struts.

Jignesh Patel wrote:
   

On Monday 10 May 2004 17:21, Jignesh Patel wrote:
I am just wondering, how concurrent request will be handled by single
Action class. Because for many form objects(as there are thousands of
browser running with jsp forms) and there is only one action class.
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


concurrency in struts

2004-05-10 Thread Jignesh Patel
I am just wondering, how concurrent request will be handled by single Action 
class. Because for many form objects(as there are thousands of clients) there 
are only one action class.






-- 
Jignesh Patel
Project Leader

Bang Software Technolgy Pvt. Ltd.

 
 (E) [EMAIL PROTECTED]

 (T) 091 484 3942132


 B-4, Smart Business Centre,
 Infopark, SDF IT Building,
 Kusumagiri P.O.,Kakkanad,
 Kochi - 682030,
 Kerala,
 India.

 Information contained in this transmission to the named  addressee, including 
any attachments thereto, should be
 considered the proprietary and confidential information of the sender.  As a 
condition for viewing the information,
 the sender agrees to keep the information confidential, to  refrain from 
disclosing the information, directly or
 indirectly, and to refrain from any actions that would  constitute or 
facilitate unauthorized access to the 
 information without express permission from the sender. The recipient also 
acknowledges and agrees to respect
 sender's intellectual property rights in and to the  information.  If the 
recipient of this transmission is not
 the named addressee, the recipient should immediately notify the sender and 
destroy the information transmitted
 without making any copy or distribution thereof. 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: concurrency in struts

2004-05-10 Thread Ludovic Maitre
Hello,

I think, but i hope that somebody could answer better, that the servlet 
container will instantiate a new Servlet, and accompanying Action 
classes, if this is needed. As far as i know, in J2EE, this is the 
servlet container who is responsible for forking new threads for the 
clients on-demand.

Could somebody confirm (or infirm) that this is right ?

Best regards,
Ludo
Jignesh Patel wrote:
On Monday 10 May 2004 17:21, Jignesh Patel wrote:
 I am just wondering, how concurrent request will be handled by single
 Action class. Because for many form objects(as there are thousands of
 browser running with jsp forms) and there is only one action class.


--
Ludovic Maître
Factory Productions | Tél: (33) 04 93 07 08 00
149, avenue des mimosas | Fax: (33) 04 93 07 04 02
06700 Saint-Laurent-du-Var (France) | Web: http://www.factory.fr


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: concurrency in struts

2004-05-10 Thread Geeta Ramani
Yes, somebody did indeed answer better.. Please see Manfred Wolff's earlier response 
in this thread. :)

 -Original Message-
 From: Ludovic Maitre [mailto:[EMAIL PROTECTED]
 Sent: Monday, May 10, 2004 9:08 AM
 To: Struts Users Mailing List
 Subject: Re: concurrency in struts
 
 
 Hello,
 
 I think, but i hope that somebody could answer better, that 
 the servlet 
 container will instantiate a new Servlet, and accompanying Action 
 classes, if this is needed. As far as i know, in J2EE, this is the 
 servlet container who is responsible for forking new threads for the 
 clients on-demand.
 
 Could somebody confirm (or infirm) that this is right ?
 
 Best regards,
 Ludo
 
 Jignesh Patel wrote:
  On Monday 10 May 2004 17:21, Jignesh Patel wrote:
   I am just wondering, how concurrent request will be 
 handled by single
   Action class. Because for many form objects(as there are 
 thousands of
   browser running with jsp forms) and there is only one action class.
  
 
 
 -- 
 Ludovic Maître
 
 Factory Productions | Tél: (33) 04 93 07 08 00
 149, avenue des mimosas | Fax: (33) 04 93 07 04 02
 06700 Saint-Laurent-du-Var (France) | Web: http://www.factory.fr
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: concurrency in struts

2004-05-10 Thread Jignesh Patel
Hi Geeta,
Can you elaborate more?

-Jignesh
On Monday 10 May 2004 18:18, Geeta Ramani wrote:
 Jignesh:

 The execute method of the Action class includes (among others) as params
 the request, response objects of each user.. That I believe is the key..:)

 Regards,
 Geeta

  -Original Message-
  From: Jignesh Patel [mailto:[EMAIL PROTECTED]
  Sent: Monday, May 10, 2004 8:54 AM
  To: Struts Users Mailing List
  Subject: concurrency in struts
 
 
  On Monday 10 May 2004 17:21, Jignesh Patel wrote:
   I am just wondering, how concurrent request will be handled by single
   Action class. Because for many form objects(as there are thousands of
   browser running with jsp forms) and there is only one action class.
 
  --
  Jignesh Patel
  Project Leader

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Jignesh Patel
Project Leader

Bang Software Technolgy Pvt. Ltd.

 
 (E) [EMAIL PROTECTED]

 (T) 091 484 3942132


 B-4, Smart Business Centre,
 Infopark, SDF IT Building,
 Kusumagiri P.O.,Kakkanad,
 Kochi - 682030,
 Kerala,
 India.

 Information contained in this transmission to the named  addressee, including 
any attachments thereto, should be
 considered the proprietary and confidential information of the sender.  As a 
condition for viewing the information,
 the sender agrees to keep the information confidential, to  refrain from 
disclosing the information, directly or
 indirectly, and to refrain from any actions that would  constitute or 
facilitate unauthorized access to the 
 information without express permission from the sender. The recipient also 
acknowledges and agrees to respect
 sender's intellectual property rights in and to the  information.  If the 
recipient of this transmission is not
 the named addressee, the recipient should immediately notify the sender and 
destroy the information transmitted
 without making any copy or distribution thereof. 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: concurrency in struts

2004-05-10 Thread Jignesh Patel
Riyad,
But does this methods are synchronized? Otherwise if two threads execute at 
the same time they can access the method at the same time. And result will be 
big mess.

-Jignesh
On Monday 10 May 2004 18:29, Riyad Kalla wrote:
 This question is actually what made me sign up to this mailing list...
 the answer is that there is no implicit concurrency. All your
 work/variables in Actions should be method-scoped and not use ANY class
 variables because of this. My specific questions was that I wanted to
 use a class variable ActionErrors so any of my methods
 (DispatchAction) could add errors without initializing a new ActionError
 instance, and return it. But this is incorrect and can/will introduce
 problems.

 So there is no concurrency in Struts.

 Jignesh Patel wrote:
 On Monday 10 May 2004 17:21, Jignesh Patel wrote:
  I am just wondering, how concurrent request will be handled by single
  Action class. Because for many form objects(as there are thousands of
  browser running with jsp forms) and there is only one action class.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Jignesh Patel
Project Leader

Bang Software Technolgy Pvt. Ltd.

 
 (E) [EMAIL PROTECTED]

 (T) 091 484 3942132


 B-4, Smart Business Centre,
 Infopark, SDF IT Building,
 Kusumagiri P.O.,Kakkanad,
 Kochi - 682030,
 Kerala,
 India.

 Information contained in this transmission to the named  addressee, including 
any attachments thereto, should be
 considered the proprietary and confidential information of the sender.  As a 
condition for viewing the information,
 the sender agrees to keep the information confidential, to  refrain from 
disclosing the information, directly or
 indirectly, and to refrain from any actions that would  constitute or 
facilitate unauthorized access to the 
 information without express permission from the sender. The recipient also 
acknowledges and agrees to respect
 sender's intellectual property rights in and to the  information.  If the 
recipient of this transmission is not
 the named addressee, the recipient should immediately notify the sender and 
destroy the information transmitted
 without making any copy or distribution thereof. 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: concurrency in struts

2004-05-10 Thread Daniel Perry
Each request to the same action subclass uses the same object.  The method
is called passing all necessary parameters to it.  Therefore you should not
use any class variables, only local variables.

Ie, a MyAction class is created once, and for each request to it, it's
method is called:

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)

This object is retained throughout application lifecycle, and reused for
each request.

Daniel.

-Original Message-
From: Jignesh Patel [mailto:[EMAIL PROTECTED]
Sent: 10 May 2004 14:04
To: Struts Users Mailing List; Geeta Ramani
Subject: Re: concurrency in struts


Hi Geeta,
Can you elaborate more?

-Jignesh
On Monday 10 May 2004 18:18, Geeta Ramani wrote:
 Jignesh:

 The execute method of the Action class includes (among others) as params
 the request, response objects of each user.. That I believe is the key..:)

 Regards,
 Geeta

  -Original Message-
  From: Jignesh Patel [mailto:[EMAIL PROTECTED]
  Sent: Monday, May 10, 2004 8:54 AM
  To: Struts Users Mailing List
  Subject: concurrency in struts
 
 
  On Monday 10 May 2004 17:21, Jignesh Patel wrote:
   I am just wondering, how concurrent request will be handled by single
   Action class. Because for many form objects(as there are thousands of
   browser running with jsp forms) and there is only one action class.
 
  --
  Jignesh Patel
  Project Leader

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

--
Jignesh Patel
Project Leader

Bang Software Technolgy Pvt. Ltd.


 (E) [EMAIL PROTECTED]

 (T) 091 484 3942132


 B-4, Smart Business Centre,
 Infopark, SDF IT Building,
 Kusumagiri P.O.,Kakkanad,
 Kochi - 682030,
 Kerala,
 India.

 Information contained in this transmission to the named  addressee,
including
any attachments thereto, should be
 considered the proprietary and confidential information of the sender.  As
a
condition for viewing the information,
 the sender agrees to keep the information confidential, to  refrain from
disclosing the information, directly or
 indirectly, and to refrain from any actions that would  constitute or
facilitate unauthorized access to the
 information without express permission from the sender. The recipient also
acknowledges and agrees to respect
 sender's intellectual property rights in and to the  information.  If the
recipient of this transmission is not
 the named addressee, the recipient should immediately notify the sender and
destroy the information transmitted
 without making any copy or distribution thereof.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]