| | |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.support.TransactionTemplate; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | private Thread actionPublicThread; |
| | | |
| | | @Autowired |
| | | private TransactionTemplate txTemplate; |
| | | @Autowired |
| | | private AgvService agvService; |
| | | @Autowired |
| | |
| | | .eq(Segment::getState, SegmentStateType.WAITING.toString()) |
| | | ); |
| | | for (Segment segment : segments) { |
| | | // long startTime = System.currentTimeMillis(); |
| | | if (!transferStationHandler.hasDelayAtSta(segment)) { |
| | | trafficService.trigger(segment); |
| | | continue; |
| | | } |
| | | // log.info("traffic calculation spend {} ms", System.currentTimeMillis() - startTime); |
| | | try { |
| | | txTemplate.executeWithoutResult(status -> { |
| | | trafficService.trigger(segment); |
| | | }); |
| | | } catch (Exception e) { |
| | | log.error("trigger fail segId={}", segment.getId(), e); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | // todo test TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error("KernelScheduler.trafficCalcThread fail", e); |
| | | } |
| | | } |