Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. public int runAggregation(List<String> terminals) throws SQLException {
  2. long t0 = System.currentTimeMillis();
  3.  
  4. int i = runSubPeriodAggregation(terminals);
  5. Session session = SessionFactoryController.getInstance().getSessionFactory().openSession();
  6. ScrollableResults scroll = getTerminals(session, terminals);
  7. try {
  8. while (scroll.next()) {
  9. long t1 = System.currentTimeMillis();
  10.  
  11. OBPOSApplications terminal = (OBPOSApplications) scroll.get(0);
  12. checkLastDayPeriodAggregated(terminal);
  13.  
  14. Date selectedPeriod = periodStart;
  15. Date firstPeriod = getFirstPeriodWithoutAggregation(terminal);
  16.  
  17. for (Date period = firstPeriod; period
  18. .compareTo(selectedPeriod) <= 0; period = periodNext) {
  19. long t2 = System.currentTimeMillis();
  20.  
  21. initPeriod(period);
  22. aggregatePeriod(terminal);
  23.  
  24. OBDal.getInstance().getConnection(false).commit();
  25. OBDal.getInstance().getSession().clear();
  26. i++;
  27.  
  28. log.debug("Aggregation for period {} took: {} ms.", period,
  29. System.currentTimeMillis() - t2);
  30. }
  31. log.debug("Aggregation for terminal {} took: {} ms.", terminal.getName(),
  32. System.currentTimeMillis() - t1);
  33. }
  34. log.debug("Aggregation took: {} ms.", System.currentTimeMillis() - t0);
  35. } finally {
  36. scroll.close();
  37. if (session.isOpen()) {
  38. session.close();
  39. }
  40. }
  41.  
  42. return i;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement