|
|
@@ -57,30 +57,30 @@ public class TblModBusController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping("/thread")
|
|
|
- public void thread(DataFormatBean bean){
|
|
|
-// dealservice.setModBusTcp(bean);
|
|
|
-// dealservice.getModBusTcp(bean);
|
|
|
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
- System.out.println("时间:" + sdf.format(new Date()) );
|
|
|
- for (int i = 0; i < queue.size(); i++) {
|
|
|
- executor.scheduleWithFixedDelay(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- String value = ThreadPoolTask.queue.poll();
|
|
|
- if (value != "" && null != value) {
|
|
|
- System.out.println("时间:" + sdf.format(new Date()) + " 线程" + Thread.currentThread().getName() + " 执行了task: " + value);
|
|
|
- }
|
|
|
- try {
|
|
|
- TimeUnit.SECONDS.sleep(5);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }, 2, 6, TimeUnit.SECONDS);
|
|
|
- }
|
|
|
- }
|
|
|
+// @GetMapping("/thread")
|
|
|
+// public void thread(DataFormatBean bean){
|
|
|
+//// dealservice.setModBusTcp(bean);
|
|
|
+//// dealservice.getModBusTcp(bean);
|
|
|
+// ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
|
|
|
+// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
+// System.out.println("时间:" + sdf.format(new Date()) );
|
|
|
+// for (int i = 0; i < queue.size(); i++) {
|
|
|
+// executor.scheduleWithFixedDelay(new Runnable() {
|
|
|
+// @Override
|
|
|
+// public void run() {
|
|
|
+// String value = ThreadPoolTask.queue.poll();
|
|
|
+// if (value != "" && null != value) {
|
|
|
+// System.out.println("时间:" + sdf.format(new Date()) + " 线程" + Thread.currentThread().getName() + " 执行了task: " + value);
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// TimeUnit.SECONDS.sleep(5);
|
|
|
+// } catch (InterruptedException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }, 2, 6, TimeUnit.SECONDS);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
@GetMapping("/modbusTcpCache")
|
|
|
public void addModbusCache(TblModbusTcp tblModbusTcp){
|