Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
krishna kishore
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic