本文整理匯總了Java中org.apache.spark.streaming.scheduler.StreamingListenerBatchCompleted類的典型用法代碼示例。如果您正苦於以下問題:Java StreamingListenerBatchCompleted類的具體用法?Java StreamingListenerBatchCompleted怎麽用?Java StreamingListenerBatchCompleted使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StreamingListenerBatchCompleted類屬於org.apache.spark.streaming.scheduler包,在下文中一共展示了StreamingListenerBatchCompleted類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBatchCompleted
import org.apache.spark.streaming.scheduler.StreamingListenerBatchCompleted; //導入依賴的package包/類
@Override
public void onBatchCompleted(
StreamingListenerBatchCompleted batchCompleted) {
batchCompletedCount++;
int queueSize = batchSubmittedCount - batchCompletedCount;
boolean backPressureEnabled = (boolean) config._backpressureEnabled;
if (backPressureEnabled) {
long processingDelay =
(Long) batchCompleted.batchInfo().processingDelay().get();
long schedulingDelay =
(Long) batchCompleted.batchInfo().schedulingDelay().get();
//Skip first batch as it may pull very less records which can have wrong rate for next batch
if(batchCompletedCount > 1) {
// Get last batch fetch size
int batchFetchSize = getFetchSize();
LOG.info("Current Rate in ZooKeeper : " + batchFetchSize);
// Revise rate on last rate
int newRate = controller.calculateRate(config, batchDuration,
batchFetchSize, fillFreqMs, schedulingDelay, processingDelay);
LOG.info("Modified Rate by Controller : " + newRate);
// Setting to Min Rate
if (newRate < MIN_RATE) {
newRate = MIN_RATE;
}
// Setting to Max Rate
if (newRate > config._pollRecords) {
newRate = config._pollRecords;
}
if (queueSize > THROTTLE_QUEUE) {
LOG.warn("Controller rate not applied as waiting queue is greater than throttle queue");
} else {
Utils.setFetchRate(config, newRate);
}
}
}
}
示例2: onBatchCompleted
import org.apache.spark.streaming.scheduler.StreamingListenerBatchCompleted; //導入依賴的package包/類
@Override
public void onBatchCompleted(StreamingListenerBatchCompleted batchCompleted) {
// not implemented
}