This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes initialising a class (a common util) object inside my action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "initialising a class (a common util) object inside my action" Watch "initialising a class (a common util) object inside my action" New topic

initialising a class (a common util) object inside my action

krishna kishore

Joined: Oct 30, 2007
Posts: 19
dear all,
im involved in a project that uses struts completely. all transaction in our project holds some specific features that are common between them. (example, client details etc). we have tried making a common action class (ex. client profile action) to support various transactions. but the problem here is the load that is forced upon a common action class. it effects the performance of the application.
now, i have devised a new way of segregating the common features to a normal class and use this class in the independent action classes. for example, the client profile action to all transactions, simultaneously uses the common features from the java class i have created.
The question is, does it effect the performance and integrity in such a way that the instances overlaps with the others.

The below design will visualize the scenario.

Old design
transaction A----->CommonClientProfileAction<-----Transaction B

(many actions call to a single clientprofileaction class)

New design

Transaction A-----> ClientProfileActionA |
Transaction A-----> ClientProfileActionB |------
Transaction C-----> ClientProfileActionC | |
--------------------------------------------| |
(independent action class utilizes the common feature present in the normal common class by creating its own instances.)

sorry for my poor design
thanks in advance
cheers everybody

urs respectfully
[ March 25, 2008: Message edited by: krishna kishore ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
What container are you using? I am curious about why you think that using a common action class affects the performance of your application. This is an area where my knowledge is a bit fuzzy. I would think that your container could have multiple threads all using the same action instance.

- Brent
krishna kishore

Joined: Oct 30, 2007
Posts: 19
Dear Brent
I am using weblogic as my web continer. does not the lots of "request threads" accessing a single resource will slow down the process? rather we split different request as separate resources. its hard to maintain the code also when we write hundreds and thousands of lines in single action class. here in the second design, the common utils were segregated from the main action. action containing only the reference to the common util class and its methods.

cheers all
Have you checked out Aspose?
subject: initialising a class (a common util) object inside my action
It's not a secret anymore!