if(lcName==null) {
names=mpc.getThreadScopeNames();
}
else names=ListUtil.listToStringArray(lcName, ',');
ChildThread ct;
Threads ts;
long start=System.currentTimeMillis(),_timeout=timeout>0?timeout:-1;
for(int i=0;i<names.length;i++) {
if(StringUtil.isEmpty(names[i],true))continue;
//PageContextImpl mpc=(PageContextImpl)getMainPageContext(pc);
ts = mpc.getThreadScope(names[i]);
if(ts==null)
throw new ApplicationException("there is no thread running with the name ["+names[i]+"], only the following threads existing ["+ListUtil.arrayToList(mpc.getThreadScopeNames(),", ")+"]");
ct=ts.getChildThread();
if(ct.isAlive()) {
try {
if(_timeout!=-1)ct.join(_timeout);
else ct.join();
}
catch (InterruptedException e) {}
}
if(_timeout!=-1){
_timeout=_timeout-(System.currentTimeMillis()-start);