gives that away.) We can't find problems if we don't see the real code!
Nothing you've shown here involves multiple threads, so nothing requires these methods to be synchronized (of course, nothing requires "list" to be a member as opposed to a local, either, so again you're not showing us the whole picture.
Maybe you're confused about where the code is going? There are a lot of variables and methods with similar names here, and maybe you're looking at the wrong ones. I know it's hard for me to find my way around. For example, you show the method
public synchronized ResultSet getSqlResultSet(String _sql) throws NpException
but it isn't called anywhere in your example code; you don't show
List getSqlResultList(ResultSet rs)
which is called from getDefaultSalesmanInfo(); in fact, it's the only thing called after setSqlParam(), so it's the only thing that would have a chance to report the problem you're seeing. Take a good look at getSqlResultList() and see if that doesn't clear things up...
OK, so now, in the call tree starting from getDefaultSalesmanInfo(), you're never calling getSqlParam(). So how do you know that the member sqlList is of length 0?
Ernest, you are right , i very disappointed with such stupid mistake,
anyway, when we use synchronized method, should we put all method as synchronized ?
for example, should i get rig on synchronized in getSqlResultSet() method? the reason i think on get rid it, is due to the getSqlResultSet() might share by other method..
say if getSqlResultSet() is a general method to execute query, it might call by other method as well , if i make it synchronized, would it affect other method which couldn't access it ?
lastly , thank you very much for your guidance and have a nice day
Post by:autobot
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, the permaculture playing cards