本文整理汇总了Java中com.sforce.async.BatchInfoList类的典型用法代码示例。如果您正苦于以下问题:Java BatchInfoList类的具体用法?Java BatchInfoList怎么用?Java BatchInfoList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BatchInfoList类属于com.sforce.async包,在下文中一共展示了BatchInfoList类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBatchInfoList
import com.sforce.async.BatchInfoList; //导入依赖的package包/类
protected BatchInfoList getBatchInfoList(String jobID) throws AsyncApiException, ConnectionException {
try {
return bulkConnection.getBatchInfoList(jobID);
} catch (AsyncApiException sfException) {
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
SalesforceRuntimeCommon.renewSession(bulkConnection.getConfig());
return getBatchInfoList(jobID);
}
throw sfException;
}
}
示例2: isJobBatchesInProgress
import com.sforce.async.BatchInfoList; //导入依赖的package包/类
/**
* Checks if job batch infos were processed correctly. Only if all batches were {@link BatchStateEnum#Completed} are acceptable.<br/>
* If any of batches returns {@link BatchStateEnum#Failed} or {@link BatchStateEnum#NotProcessed} - throws an exception.
*
* @param batchInfoList - batch infos related to the specific job.
* @param info - batch info for query batch.
* @return true - if job is not processed fully, otherwise - false.
*/
private boolean isJobBatchesInProgress(BatchInfoList batchInfoList, BatchInfo info) {
for (BatchInfo batch : batchInfoList.getBatchInfo()) {
if (batch.getId().equals(info.getId())) {
continue;
}
/*
* More details about every batch state can be found here:
* https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_batches_interpret_status.htm
*/
switch (batch.getState()) {
case Completed:
break;
case NotProcessed:
/* If batch was not processed we should abort further execution.
* From official documentation:
* The batch won’t be processed. This state is assigned when a job is aborted while the batch is queued.
*/
case Failed:
TalendRuntimeException.build(SalesforceErrorCodes.ERROR_IN_BULK_QUERY_PROCESSING)
.put(ExceptionContext.KEY_MESSAGE, batch.getStateMessage()).throwIt();
case Queued:
case InProgress:
return true;
}
}
return false;
}
示例3: waitForPkBatches
import com.sforce.async.BatchInfoList; //导入依赖的package包/类
/**
* Waits for the PK batches to complete. The wait will stop after all batches are complete or on the first failed batch
* @param batchInfoList list of batch info
* @param retryInterval the polling interval
* @return the last {@link BatchInfo} processed
* @throws InterruptedException
* @throws AsyncApiException
*/
private BatchInfo waitForPkBatches(BatchInfoList batchInfoList, int retryInterval)
throws InterruptedException, AsyncApiException {
BatchInfo batchInfo = null;
BatchInfo[] batchInfos = batchInfoList.getBatchInfo();
// Wait for all batches other than the first one. The first one is not processed in PK chunking mode
for (int i = 1; i < batchInfos.length; i++) {
BatchInfo bi = batchInfos[i];
// get refreshed job status
bi = this.bulkConnection.getBatchInfo(this.bulkJob.getId(), bi.getId());
while ((bi.getState() != BatchStateEnum.Completed)
&& (bi.getState() != BatchStateEnum.Failed)) {
Thread.sleep(retryInterval * 1000);
bi = this.bulkConnection.getBatchInfo(this.bulkJob.getId(), bi.getId());
log.debug("Bulk Api Batch Info:" + bi);
log.info("Waiting for bulk resultSetIds");
}
batchInfo = bi;
// exit if there was a failure
if (batchInfo.getState() == BatchStateEnum.Failed) {
break;
}
}
return batchInfo;
}