File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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

krishna kishore
Greenhorn

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 | |
--------------------------------------------| |
|
\/
CommonClientProfileUtils{
searchClient(),
editClient(),
saveClient(),
validateClient()
etc...
}
(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
krishna
[ 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
Greenhorn

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
urs
krishna
 
Don't get me started about those stupid light bulbs.
 
subject: initialising a class (a common util) object inside my action