Originally posted by John Todd: Hi. My EJB reads some files from the hard drive. The problem is that the reading process is taking a long time or even it is hanging up. Do you suggest a solution for this problem ? Thanks for help.
Correlating with the other topic you have posted, i think your problem is of transaction timeout. If that is the problem then i can think of the following options: 1) Increase the tx timeout period. However, this is not at all a neat solution as determining a big enough transaction timeout to account for all processing delay is not possible. 2) Try if you can actually move to an asynchronous model. 3) Try creating an entity that reads the file contents for you and once read it caches the contents in memory. (Assure either all modification to the file goes through this entity or it gets a callback for the changes done on the file.) You can load this entity on application startup and then the EJB can query this entity for the data.