さまざまな掲示板で問題の解決策を見つけようとしました。しかし、私は壁にぶつかっています。Mysql INNODB テーブルのデータベース「LockWait Timeout」で発生している問題を再現しようとしています。(私が解決しようとしている問題については、http: //bugs.mysql.com/bug.php ?id=10641 にアクセスしてください) 問題を絞り込み、解決策を見つけました。ただし、テスト環境で問題を再現できないため、ソリューションをテストできます。
これが私のコードです:
public static void main(String[] args) {
System.out.println("Programm Starting");
int numberOfthreads = 2;
for(int x = 1; x <= numberOfthreads; x++){
//Create the object UpdateClass
// Create the Runable object
Runnable r = new Runnable() {
// Start the Runnable
public void run() {
System.out.println("Running");
}
};
Thread thr = new Thread(r);
System.out.println("Thread object created");
thr.start();
final UpdateClass session = new UpdateClass(x);
System.out.println("Thread object started");
try {
System.out.println("Starting UpdateClass.runProcess()");
session.runProcess();
Thread.sleep(1);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
thr.stop();
System.out.println("Thread stopped");
}
}
基本的に、同時 UPDATE を MySql テーブルに複製して、LockWait Timeout の問題を作成しようとしています。
私のクラス UpdateClass は必要な方法で動作しますが、同時イベントを再作成してクラスを呼び出すことはできません。
質問: コードを変更して、タイムアウトにつながる条件を生成する可能性を高めるにはどうすればよいですか?