Subversion Repositories SmartDukaan

Rev

Rev 30209 | Rev 30352 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30209 Rev 30315
Line 25... Line 25...
25
	private static final Logger LOGGER = LogManager.getLogger(OppoImeiActivationService.class);
25
	private static final Logger LOGGER = LogManager.getLogger(OppoImeiActivationService.class);
26
	@Autowired
26
	@Autowired
27
	ActivatedImeiRepository activatedImeiRepository;
27
	ActivatedImeiRepository activatedImeiRepository;
28
 
28
 
29
	public void updateActivationDate(List<String> imeis) throws Exception {
29
	public void updateActivationDate(List<String> imeis) throws Exception {
30
		int chromeThreads = 5;
30
		int chromeThreads = 7;
31
		int bucketSize = imeis.size() / chromeThreads;
31
		int bucketSize = 4;
32
		/*List<ImeiActivationTimestampModel> imeisActivationList = activatedImeiRepository
-
 
33
				.selectImeiActivationByBrand("Oppo");*/
-
 
34
		//List<String> imeisSubList = imeis.subList(0, chromeThreads*bucketSize).stream().map(x -> x.getSerialNumber()).collect(Collectors.toList());
-
 
35
		ExecutorService excecutorService = Executors.newFixedThreadPool(chromeThreads);
32
		ExecutorService excecutorService = Executors.newFixedThreadPool(chromeThreads);
36
		List<String> imeisSubList = imeis.subList(0, chromeThreads * bucketSize);
-
 
37
		List<CheckOppoWarrantyTask> tasks = new ArrayList<>();
33
		List<CheckOppoWarrantyTask> tasks = new ArrayList<>();
38
		for (int i = 0; i < chromeThreads; i++) {
34
		for (int i = 0; i < imeis.size() / bucketSize; i++) {
39
			CheckOppoWarrantyTask task = new CheckOppoWarrantyTask(imeisSubList.subList(i * bucketSize, (i + 1) * bucketSize));
35
			CheckOppoWarrantyTask task = new CheckOppoWarrantyTask(imeis.subList(i * bucketSize, (i + 1) * bucketSize));
40
			tasks.add(task);
36
			tasks.add(task);
41
		}
37
		}
42
		List<Future<Map<String, LocalDate>>> futures = excecutorService.invokeAll(tasks);
38
		List<Future<Map<String, LocalDate>>> futures = excecutorService.invokeAll(tasks);
43
		List<String> foundImeis = new ArrayList<>();
39
		List<String> foundImeis = new ArrayList<>();
44
		futures.stream().forEach(x -> {
40
		futures.stream().forEach(x -> {