Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reseting arrays

Status
Not open for further replies.

TheKing

Programmer
Feb 25, 2002
151
US
hi everyone.... i have an jsp file which imports a class that runs a process. The thing is that such class i use it in differents jsp file by calling it methods. This methods return me some arrays but the problem is that when i call the method for the second, it keeps in memory the values of the last time i calle the method. Has something to do with the garbage collector???
how can i reset the values of the array after the method returns them
 
assumption: you are using the class in the way it asks you to. if that's true, then this looks to be the fault of the class you're importing. it may not be properly resetting its attributes after successive calls to a re-calculate method. make sure you're making a new instance of the class everytime you need the values to be different, unless some other method is provided to re-initialize those output arrays, and if neither of these work, look to the insides of the class.

worst case sceanario is if the class was poorly designed and uses only static (class) variables and methods, as well as not having a re-calculate method. if so, then you may have to rewrite it a little bit, so that you can have multiple instances with different values assigned to the various attributes.

if you give a little more detail about the class in question, there might be more ways to solve this than what i just suggested.

HTH,
stillflame "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top