class test1 extends Thread{
public void run(){
for(int a=0;a<50;a++)
System.out.println("a="+a);
}
}
class test2 extends Thread{
public void run(){
for(int i=50;i>0;i--)
System.out.println("i="+i);
}
}
public class Actions
{
public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
test1 t1=new test1();
test2 t2=new test2();
t1.start();
t2.start();
// t1.run();
// t2.run();
return 0;
}//end of action
public int end() throws Throwable {
return 0;
}//end of end
}
为什么执行后没有打印出内容?直接就运行完了.看log里面报错 Error (-17998): Failed to get [param not passed in call] thread TLS entry 不明白是什么意思.
代码在别的环境下 比如Eclipse 能正常执行并打印出结果??作者: orceric 时间: 2010-4-12 16:18
在lr中通过调用java class文件也不行.在lr中F5就直接运行完了,也没有打印出内容.然后log里面有错误
Error (-17998): Failed to get [param not passed in call] thread TLS entry.
是不是Vuser不能使用多线程的方式?或是Vuser不支持java的多线程?还是我使用的方法不当?
package thread.test;
public class test3 extends Thread {
private int a=0;
public void run(){
for(a=0;a<50;a++){
System.out.println(currentThread().getName()+":"+a);
try{
sleep(100);
}catch(InterruptedException e){throw new RuntimeException(e);}
}
}
}
lr脚本
import lrapi.lr;
import thread.test.*;
public class Actions
{
public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
test3 t3=new test3();
t3.start();
return 0;
}//end of action
public int end() throws Throwable {
return 0;
}//end of end
}作者: mihuxu520 时间: 2010-4-12 16:44
t1.run();
t2.run();