Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and file read/write  RSS feed

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following method in my EJB
method1(){
...
myFileReader.readFile("file Name");
}
In the above code, instead of reading the file in EJB (Which shouldn't be done as the container doesnt guarantee proper behaviour), the operation is delegated to "myFileReader" class readFile() method.
1. Does the container gurantee a proper behaviour in this case since iam not reading any file in EJB ? if yes, i feel iam reading the file indirectly.
2. If i want to read some file in an EJB, whats the best solution ?
 
Maximilian Trenks
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is an interesting question.
i wonder if the class is executed in the container environment or not.
sorry i can't help, but i will follow this topic.
 
Suresh Selvaraj
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Since there is no mention about the contents/size of the file to be read, for a moderate file size with approx. 1000 lines of name/value pairs,
I 'd read the file when the server starts up, cache it and use it in EJb or elsewhere.

Suresh Selvaraj
SCJP2
 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What if the file to be read/written is dependent on the user session which is stored as stateful session bean ?
Hari
[ April 24, 2003: Message edited by: Hari babu ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!