修改生产环境配置
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.gzzn.omms.msgexchangeapi.runner;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class ScheduledExecutorServiceTest {
|
||||
|
||||
@Test
|
||||
public void testRun()
|
||||
{
|
||||
//启动消息采集线程
|
||||
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
|
||||
scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("start ...");
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("end ...");
|
||||
}
|
||||
}, 0, 1 , TimeUnit.SECONDS);
|
||||
|
||||
while (true) {
|
||||
|
||||
}
|
||||
}//end function
|
||||
}
|
||||
Reference in New Issue
Block a user