修改生产环境配置

This commit is contained in:
zhouxiunai
2019-01-29 14:44:19 +08:00
parent 9f80b92587
commit 82e39bf91c
2 changed files with 47 additions and 3 deletions
@@ -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
}