| | |
| | | @Component |
| | | public class KernelScheduler { |
| | | |
| | | public static int CORE_SCAN_FREQUENCY_MILLISECOND = 30; |
| | | public static int CORE_SCAN_FREQUENCY_MILLISECOND = 15; |
| | | |
| | | private static final int LOCK_TIMEOUT = 5; |
| | | |
| | |
| | | for (Segment segment : segments) { |
| | | long startTime = System.currentTimeMillis(); |
| | | trafficService.trigger(segment); |
| | | long algoTime = System.currentTimeMillis() - startTime; |
| | | log.info("traffic calculation spend {} ms", algoTime); |
| | | if (segment.getState().equals(SegmentStateType.RUNNING.toString())) { |
| | | segment.setAlgoTime((int) algoTime); |
| | | segmentService.updateById(segment); |
| | | } |
| | | log.info("traffic calculation spend {} ms", System.currentTimeMillis() - startTime); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | try { |
| | | Thread.sleep(CORE_SCAN_FREQUENCY_MILLISECOND); |
| | | |
| | | List<String> actionGroupIds = actionService.selectPrepareGroup(); |
| | | List<String> actionGroupIds = actionService.selectGroupNo(ActionStsType.PREPARE); |
| | | for (String actionGroupId : actionGroupIds) { |
| | | mainService.publishAction(actionGroupId); |
| | | } |