Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File load

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have many session beans.I have a properties file which has the app.
specific information.I am using the values from the properties file in all
my beans.
My question is "Is there any way to load the properties file only once,
that is, when the first ejb's method (Any ejb method can be invoked first.) gets invoked"?
I can put the code in ejbCreate() to load the properties file.
But, I don't want to repeat the same code in all ejb's ejbCreate()
methods .

I want to know whether a simple and better solution is there other than
the above.

Thanks in advance,
 
Annie Smith
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible way could be to use a singleton class to load the properties file.

 
Annie Smith
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, I only typed that code on the fly. You will need to modify it to actually use it in a J2EE environment. I doubt if it is a good idea to use a singleton in J2EE environment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic