Procházet zdrojové kódy

Merge branch 'develop' of http://112.172.147.34:4936/style24/style24.batch into develop

jsshin před 5 roky
rodič
revize
a71636a934

+ 18 - 10
src/main/java/com/style24/batch/biz/job/TsbAbstractJob.java

@@ -117,21 +117,29 @@ public abstract class TsbAbstractJob<I, O, R> {
 			batchLogSq = batchService.createBatchLog(batchId);
 		}
 
-		this.printStart();
+		try {
+			this.printStart();
 
-		readItem = this.read();
+			readItem = this.read();
 
-		if (readItem != null) {
-			convertedItem = this.process(readItem);
+			if (readItem != null) {
+				convertedItem = this.process(readItem);
 
-			resultItem = this.write(convertedItem);
+				resultItem = this.write(convertedItem);
 
-			this.notify(resultItem);
-		} else { // 배치 처리할 대상 데이터가 없으면 종료
-			log.info("처리할 데이터가 없습니다.\n");
-		}
+				this.notify(resultItem);
+			} else { // 배치 처리할 대상 데이터가 없으면 종료
+				log.info("처리할 데이터가 없습니다.\n");
+			}
 
-		this.printEnd();
+			this.printEnd();
+
+		} catch (Exception e) {
+			if (StringUtils.isNotBlank(batchId)) {
+				// 배치로그 종료 처리
+				batchService.updateBatchLog(batchLogSq, batchId);
+			}
+		}
 	}
 
 	/**