public void handle()

in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/impl/handler/PutActionHandler.java [84:157]


	public void handle(PutAction action) {
		final List<Record> recordList = action.getRecordList();
		WriteMode mode = action.getWriteMode();
		AdbClientException exception = null;
		try {
			doHandlePutAction(recordList, mode);
			for (Record record : recordList) {
				markRecordPutSuccess(record);
			}
		} catch (AdbClientException e) {
			WriteFailStrategy strategy = config.getWriteFailStrategy();
			if (!isDirtyDataException(e)) {
				exception = e;
				//如果不是脏数据类异常的话,就不要one by one了
				strategy = WriteFailStrategy.NONE;
			}
			boolean useDefaultStrategy = true;
			switch (strategy) {
				case TRY_ONE_BY_ONE:
					LOGGER.warn("write data fail, current WriteFailStrategy is TRY_ONE_BY_ONE", e);
					if (e.getCode() != ExceptionCode.TABLE_NOT_FOUND) {
						List<Record> single = new ArrayList<>(1);
						AdbClientWithDetailsException fails = new AdbClientWithDetailsException(e);
						for (Record record : recordList) {
							try {
								single.add(record);
								doHandlePutAction(single, mode);
								markRecordPutSuccess(record);
							} catch (AdbClientException subE) {
								if (!isDirtyDataException(subE)) {
									exception = subE;
								} else {
									fails.add(record, subE);
								}
								markRecordPutFail(record, subE);
							} catch (Exception subE) {
								//如果是致命错误最后就抛这种类型的错
								exception = new AdbClientException(ExceptionCode.INTERNAL_ERROR, "", subE);
								markRecordPutFail(record, exception);
							} finally {
								single.clear();
							}
						}
						if (exception == null && fails.size() > 0) {
							exception = fails;
						}
						useDefaultStrategy = false;
					}
					break;
				default:
			}
			if (useDefaultStrategy) {
				for (Record record : recordList) {
					markRecordPutFail(record, e);
				}

				if (exception == null) {
					AdbClientWithDetailsException localPutException = new AdbClientWithDetailsException(e);
					localPutException.add(recordList, e);
					exception = localPutException;
				}
			}
		} catch (Exception e) {
			exception = new AdbClientException(ExceptionCode.INTERNAL_ERROR, "", e);
			for (Record record : recordList) {
				markRecordPutFail(record, exception);
			}
		}
		if (exception != null) {
			action.getFuture().completeExceptionally(exception);
		} else {
			action.getFuture().complete(null);
		}
	}