소스 검색

Merge remote-tracking branch 'origin/master'

zhouhao 7 년 전
부모
커밋
ce2093e96d

+ 3 - 3
hsweb-concurrent/hsweb-concurrent-async-job/src/main/java/org/hswebframework/web/async/AsyncJobException.java

@@ -11,14 +11,14 @@ import java.util.stream.Stream;
  * @author zhouhao
  */
 public class AsyncJobException extends RuntimeException {
-    List<Exception> errors;
+   private List<Exception> errors;
 
     public AsyncJobException(List<Exception> errors) {
-        this.errors = errors;
+       this(errors.size()>0?errors.get(0).getMessage():null,errors);
     }
 
     public AsyncJobException(String message, List<Exception> errors) {
-        super(message);
+        super(message,errors.size()>0?errors.get(0):null);
         this.errors = errors;
     }
 

+ 1 - 0
hsweb-concurrent/hsweb-concurrent-async-job/src/main/java/org/hswebframework/web/async/TransactionBatchAsyncJobContainer.java

@@ -119,6 +119,7 @@ public class TransactionBatchAsyncJobContainer implements BatchAsyncJobContainer
     }
 
     private Object getValue(Future future) {
+        if(future==null){return null;}
         try {
             return future.get();
         } catch (Exception e) {

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-async-job/src/test/java/org/hswebframework/web/async/TransactionSupportAsyncJobServiceTest.java

@@ -52,7 +52,7 @@ public class TransactionSupportAsyncJobServiceTest extends SimpleWebApplicationT
             BatchAsyncJobContainer jobContainer = asyncJobService.batch();
             jobContainer.submit(() -> {
                 Thread.sleep(50);
-                throw new RuntimeException();
+                throw new RuntimeException("1234");
             }, true);
             for (int i = 0; i < 100; i++) {
                 jobContainer.submit(() -> sqlExecutor.insert("insert into test values('test')", null), true);