當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamingListenerBatchCompleted類代碼示例

本文整理匯總了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);
        }
      }
    }
}
 
開發者ID:dibbhatt,項目名稱:kafka-spark-consumer,代碼行數:37,代碼來源:ReceiverStreamListener.java

示例2: onBatchCompleted

import org.apache.spark.streaming.scheduler.StreamingListenerBatchCompleted; //導入依賴的package包/類
@Override
public void onBatchCompleted(StreamingListenerBatchCompleted batchCompleted) {
    // not implemented
}
 
開發者ID:elastic,項目名稱:elasticsearch-hadoop,代碼行數:5,代碼來源:AbstractJavaEsSparkStreamingTest.java


注:本文中的org.apache.spark.streaming.scheduler.StreamingListenerBatchCompleted類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。