Hi Guys, Am still working on converting my SingleThreadedModel servlet into a MultiThreaded one. Just need help on one problem i got here. pls consider below code. private int main_func() { StringBuffer[][] xx=null; int r=sub_func(xx); some code here printing the contents of xx list.... } private int sub_func(StringBuffer[][] xx) { some code here.... solve ncodes xx = new StringBuffer[ncodes][2]; some code here filling up the xx arraylist. } Initially (when the code was still a SingleThreaded one), I have xx array list as an Instance variable of the servlet, i did not have this problem. But since (as suggested) a MultiThreaded servlet requires me to have this variable as a local variable (NOT use instance variables), I have created xx as a local variable of the calling method- main_func. Problem now is I can't seem to "pull-out" the populated version of the variable xx from sub_func method. I always get the "null" version/unpopulated one. In C, I can do this by passing the base address of the variable xx from main_func to sub_func and allow sub_func to allocate the mem space and populate the xx list. Is there anyway in java i can do this? pls help thanks. Jonathan
Tano_Ortiga
Greenhorn
Joined: Dec 27, 2000
Posts: 11
posted
0
Hi guys, this problem is solved already. I used an inner class which has arraylist as components instead of the 2D array. It worked! Thanks! Jonathan
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
Please note that The Java Ranch has a naming policy, described here and "Tano_Ortiga" is not a valid name as it has an "_" in it. Please choose one which meets the requirements. Thanks.