我正在使用Java Callable,所以我正在编写一个运行并行任务的函数,它在第一次调用时运行完美,但对于另一个调用,我的函数重复迭代次数 请有人能告诉我哪里弄错了 这是我的代码:
@Autowired
RechercheTabouService rechercheTabouService;
@Autowired
PlannedTripService plannedTripService;
public void test() {
System.out.println("start test");
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date date;
try {
date = dateFormat.parse("12/11/2017");
rechercheTabouService.setPlannedTrips(plannedTripService.findPlannedTripByDate(date, 1512127292, 200));
} catch (Exception e) {
e.printStackTrace();
}
rechercheTabouService.setInitialSolution();
List<Trajet> initial = rechercheTabouService.getInitialSolution();
rechercheTabouService.setInitialCost(initial);
System.out.println("initial :" + rechercheTabouService.calculCostSolution(initial));
@RequestMapping("/tabou")
public Integer runtest () {
test();
return 1;
}
}
我从这个控制器调用我的函数:
SELECT MainRequest.RequestID, UKINT, ReasonForTrip
,TripNumber, Itinerary.[Start Date], Itinerary.[End Date]
FROM MainRequest
LEFT JOIN
(
SELECT RequestID, Min(StartDate) As [Start Date]
,MAX(EndDate) As [End Date]
FROM Itinerary
GROUP by RequestID
) Itinerary
ON (MainRequest.RequestID = Itinerary.RequestID)