浏览代码

场景下载速度优化

dengsixing 3 年之前
父节点
当前提交
411e2c9122

+ 5 - 4
4dkankan-center-scene-download/src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -259,6 +259,7 @@ public class SceneDownloadHandlerServiceImpl {
         String imageNumPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
         ExecutorService executorService = Executors.newFixedThreadPool(10);
         List<String> qtFilePaths = new ArrayList<>();
+        List<Future> futureList = new ArrayList<>();
         for (String filePath : ossFilePaths) {
             Callable<Boolean> call = new Callable() {
                 @Override
@@ -267,7 +268,7 @@ public class SceneDownloadHandlerServiceImpl {
                     return true;
                 }
             };
-            executorService.submit(call);
+            futureList.add(executorService.submit(call));
         }
 //        List<Future> futureList = new ArrayList<>();
 //        for (String filePath : qtFilePaths) {
@@ -283,9 +284,9 @@ public class SceneDownloadHandlerServiceImpl {
 //            };
 //            futureList.add(executorService.submit(call));
 //        }
-//        for (Future future : futureList) {
-//            future.get();
-//        }
+        for (Future future : futureList) {
+            future.get();
+        }
     }
 
     private void test(ZipOutputStream out, List<String> ossFilePaths,