Hi David, In my test program, I invoke the IndexSearcher.close() method at the end of the loop. However, it doesn't seems to release the memory. My concern is that even though I put the IndexSearcher.close() statement in the hook methods, it may not release all the memory until the application server is shut down. Every time the EJB object is re-actived, a new IndexSearcher is open. If the resources allocated to the previous IndexSearcher cannot be fully released, the system will use up more memory. Eventually, it may run into the OutOfMemoryError.
I am not very familiar with EJB. My interpretation could be wrong. I am going to try the hook methods. Thanks for pointing this out to me. Terence > > I tried to reuse the IndexSearcher, but I have another question. What > > happen if an application server unloads the class after it is idle for a > > while, and then re-instantiate the object back when it recieves a new > > request? > > The EJB spec takes this into account, as there are hook methods you can > define that get called when your EJB object is about to be passivated or > activated. Search for something like passivate/active and/or > ejbLoad/ejbSave. This is where you should close/open your single index > searcher object. > > -- > Cheers, > David > > This message is intended only for the named recipient. If you are not the > intended recipient you are notified that disclosing, copying, distributing > or taking any action in reliance on the contents of this information is > strictly prohibited. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------- Get your free email account from http://www.trekspace.com Your Internet Virtual Desktop! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
