struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan.Johns...@WellsFargo.COM
Subject RE: why only one instance of Action class (Action class thread sa fety)
Date Wed, 07 May 2003 00:08:50 GMT
The struts designers clearly do not agree that actions 
should be single use.  They are not single use now.

This shows that Struts designers have different tastes to me.
I have yet to see one advantage of singleton actions.

What advantage of singletons am I not getting?

I have responded to the other comments.
But this seems like a useless distraction
if Singleton actions have zero advantages.

All parts of a web application do not have to be reentrant.
ActionForms do not have to be reentrant.
In general re-entrant code is very hard to test and therefore likely to be
I would suggest that all part of a web application
that are written by applications prgrammers should not be re-entrant.

To avoid the problem Craig mentioned with session,
one solution is to insert a standard object whenever you create a new
and in your request processor / wib action server / some filter, synchronize
on that object.  I think I might implement that.

All the actions I have written have no instance variables.
That's because instance variables would be useless/dangerous 
because they are shared by all requests.

However OO provides instance variables and they are useful in my designs.
When I look at actions, I see functional decomposition,
not object oriented designs.

Instantiating another object to get around this sometimes does not
work well with subclassed actions.

For an example of a shorter parameter list, see the wiki posted by Ted.

Based on road map I don't agree/understand why this is a struts 2.0 issue.
There is no need to break backward compatability.


-----Original Message-----
From: Miller, Jason []
Sent: Tuesday, May 06, 2003 1:37 PM
To: 'Struts Developers List'
Subject: RE: why only one instance of Action class (Action class thread
sa fety)

I'll throw in one thought, as well.

Having multiple instances of Actions doesn't really allow much anyway, since
ALL parts of a web app have to be reentrant.  By shifting the thread safety
issues down one level, I don't see much being gained.  Particularly in light
of the fact that Actions should be fairly lightweight, anyway.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message