sqlitemt.java

来自「主要对各种数据库性能进行测试」· Java 代码 · 共 66 行

JAVA
66
字号
package sqlite;


public class SqliteMT {

	
	public SqliteMT()
	{
		
	}
	public static void main(String[] args) {
		Configure config = new Configure();
		int insert = Integer.parseInt(config.getProperty("insert_thread_num"));
		int select = Integer.parseInt(config.getProperty("select_thread_num"));
		int update = Integer.parseInt(config.getProperty("update_thread_num"));
		for(int i= 0 ; i<insert ;i++)
		{
			new Connects(i,"SInsertA");
		}
		for(int i= 0 ; i<select ;i++)
		{
			new Connects(i,"SselectA");
		}
		for(int i= 0 ; i<update ;i++)
		{
			new Connects(i,"SupdateA");
		}
	}
}

class Connects extends Thread {
	ServerFactory sf;
	String classname ;
	int num=0;
	public Connects(int num,String classname) {
		
		this.classname = "sqlite."+classname;
		this.num = num;
		this.start();
	}

	public  void run() {
		try {
			sf = (ServerFactory) Class.forName(classname).newInstance();
			if(this == null)
				System.out.println("null--------null");
			long n=this.getId();
			System.out.println(num+"____________begin"+n);
			
			System.out.println(num+"---->>>"+this.getName() + "\n" + this.getPriority()
	                + "\n" + this.isAlive() + "\n" + this.isDaemon());

			//System.out.println(classname+"线程 <"+num+">开始执行!");
			sf.init(); 
			long m=this.getId();
			System.out.println(num+"____________end"+m);
			if(m!=n)
				System.out.println(num+"_____"+n+"_______err"+m);
			//Thread.sleep(20000);

		} catch (Exception ex) {
			System.err.println(ex.getMessage());
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?