Javaでスレッドインスタンスを作成するサンプルコード

Javaコード:
package com.startnews24.dblock.test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;

import com.startnews24.dblock.core.JobLockSupport;
import com.startnews24.dblock.core.impl.JobLockSupportImpl;

public class DBLockTest {

public static void main(String[] args) throws Exception{
PropertyConfigurator.configure(“./log4j.properties");
Log log = LogFactory.getLog(DBLockTest.class);

Thread exThread_1 = new Thread(new TestThread4Concurrent());
exThread_1.setName(“ex-Thread-1");
exThread_1.start();
Thread.sleep(3000);

Thread exThread_2 = new Thread(new TestThread4Concurrent());
exThread_2.setName(“ex-Thread-2");
exThread_2.start();

}
}

Java

Posted by arkgame