友善交流技术...

loadrunner不支持java多线程

上一篇 / 下一篇  2011-02-21 18:06:47 / 个人分类:性能测试


=========java代码=========================
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
public class TT {
public static void main(String[] args) {
// 线程池
ExecutorService exec = Executors.newCachedThreadPool();
// 只能5个线程同时访问
final Semaphore semp = new Semaphore(10);
// 模拟20个客户端访问
for (int index = 0; index < 20; index++) {
final int NO = index;
Runnable run = new Runnable() {
public void run() {
try {
// 获取许可
semp.acquire();
int c;

try {
 URL url = new URL("http://localhost:7080/webjava/");    
 java.net.URLConnection uc = url.openConnection();
 java.io.InputStream in =  uc.getInputStream(); 
 System.out.println("Accessing: " +NO +"   "+ in.toString());
 in.close();
} catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}      
//System.out.println("Accessing: " + NO);
//Thread.sleep((long) (Math.random() * 10000));
// 访问完后,释放
semp.release();
} catch (InterruptedException e) {
}
}
};
exec.execute(run);
}
// 退出线程池
exec.shutdown();
}
}
 
 
===========loadrunner 代码============
 

 public int init() throws Throwable {
  return 0;
 }//end of init

 public int action() throws Throwable {
           // Tweb.main((String []) null);
            TT.main((String []) null);
  return 0;
 }//end of action

 public int end() throws Throwable {
  return 0;
 }//end of end
 
 
在Vuser中测试通过,但是在controller里面报如下的错误
错误1:   Abnormal termination, caused by mdrv process termination.
 
错误2:
  Error (-17998): Failed to get [param not passed in call] thread TLS entry.
 
初步估计是loadrunner防止别人扩充 JAVA多线程的特点,故意做一个限制.唉...不知道是不支持呢,还是别的原因....

TAG:

引用 删除 金毛的主人   /   2016-11-01 17:14:13
你好,请问该问题是否得到确认 或者是否得到解决方法? “是loadrunner防止别人扩充 JAVA多线程的特点,故意做一个限制”
蜗牛的天空 引用 删除 superfang   /   2011-02-23 11:19:15
个人感觉,应该是一个BUG 或是限制了这个功能...
唉... 做点事就那么难...
 

评分:0

我来说两句

Open Toolbar