Article View: borland.public.jbuilder.java.language
Article #8073Re: Variable Thread through a method
From: Scott Yaung
Date: Sat, 21 Apr 2001 23:15
Date: Sat, 21 Apr 2001 23:15
31 lines
1997 bytes
1997 bytes
Steven Tseng <GetYourRedOn@yahoo.com> wrote in message news:3ae47fc9_2@dnews... > Thanx for your reply. > What my project is create a reliable ring base multicast. > Why I want to do is everytime receiving a message from neighbor, it will > create a specify thread for this message, > it will sleep a while, then check is there any broken on the ring, if not, > then it will deliver this message to upper > layer. > > > String Threadname= new String(m.MsgID); > RrmMsgThread Threadname+Integer.toString(m.MsgID) = new RrmMsgThread(); > Threadname+Integer.toString(m.MsgID).start(); Are you want to do something like this? when msgid=0; create A Thread var thread0=new Thread...; when msgid=1; create A Thread var thread1=new Thread....; ... If so, But that is not the way Java compiles, you can use single var to get serveral threads, after you create it ,put it in a pool, maybe a vector or hashtable or something else. And. The constructor of thread can use a string as the thread's name, remember, the name of thread is not same concept with the var name of a thread. Have a nice day Scott
Technical Details
Message-ID:
<3ae4b75b_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3ae46543_1@dnews> <3ae466f5_1@dnews> <3ae47fc9_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,8a66d27676cb60b0 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-23 16:45:31 PST From: "Scott Yaung" <gzscott@21cn.com> Newsgroups: borland.public.jbuilder.java.language References: <3ae46543_1@dnews> <3ae466f5_1@dnews> <3ae47fc9_2@dnews> Subject: Re: Variable Thread through a method Date: Sat, 21 Apr 2001 19:15:01 -0400 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 154.20.8.62 Message-ID: <3ae4b75b_2@dnews> X-Trace: dnews 988067675 154.20.8.62 (23 Apr 2001 16:14:35 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews