当前位置: 首页>>代码示例>>Java>>正文


Java OperatorContext.getId方法代码示例

本文整理汇总了Java中com.datatorrent.api.Context.OperatorContext.getId方法的典型用法代码示例。如果您正苦于以下问题:Java OperatorContext.getId方法的具体用法?Java OperatorContext.getId怎么用?Java OperatorContext.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datatorrent.api.Context.OperatorContext的用法示例。


在下文中一共展示了OperatorContext.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  // Needed to setup idempotency storage manager in setter
  this.context = context;
  this.operatorContextId = context.getId();

  try {
    connFactory.setHost("localhost");
    connection = connFactory.newConnection();
    channel = connection.createChannel();
    channel.exchangeDeclare(exchange, "fanout");

    this.windowDataManager.setup(context);

  } catch (IOException ex) {
    logger.debug(ex.toString());
    DTThrowable.rethrow(ex);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:21,代码来源:AbstractRabbitMQOutputOperator.java

示例2: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
 * At setup time, init last completed windowId from maxWindowTable
 *
 * @param context
 */
@Override
public void setup(OperatorContext context)
{
  operatorId = context.getId();
  try {
    mongoClient = new MongoClient(hostName);
    db = mongoClient.getDB(dataBase);
    if (userName != null && passWord != null) {
      db.authenticate(userName, passWord.toCharArray());
    }
    initLastWindowInfo();
    for (String table : tableList) {
      tableToDocumentList.put(table, new ArrayList<DBObject>());
      tableToDocument.put(table, new BasicDBObject());
    }
  } catch (UnknownHostException ex) {
    logger.debug(ex.toString());
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:25,代码来源:MongoDBOutputOperator.java

示例3: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  logger.debug("consumer {} topic {} cacheSize {}", consumer, consumer.getTopic(), consumer.getCacheSize());
  consumer.create();
  // reset the offsets to checkpointed one
  if (consumer instanceof SimpleKafkaConsumer && !offsetStats.isEmpty()) {
    Map<KafkaPartition, Long> currentOffsets = new HashMap<>();
    // Increment the offsets and set it to consumer
    for (Map.Entry<KafkaPartition, Long> e: offsetStats.entrySet()) {
      currentOffsets.put(e.getKey(), e.getValue() + 1);
    }
    ((SimpleKafkaConsumer)consumer).resetOffset(currentOffsets);
  }
  this.context = context;
  operatorId = context.getId();
  if (consumer instanceof HighlevelKafkaConsumer && !(windowDataManager instanceof WindowDataManager.NoopWindowDataManager)) {
    throw new RuntimeException("Idempotency is not supported for High Level Kafka Consumer");
  }
  windowDataManager.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:22,代码来源:AbstractKafkaInputOperator.java

示例4: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  String appId = context.getValue(DAG.APPLICATION_ID);
  operatorId = context.getId();
  outputFilePath = File.separator + appId + File.separator + operatorId;
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:9,代码来源:AbstractFSRollingOutputOperator.java

示例5: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  long windowDurationMillis = context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT) *
      context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS);
  maxEventsPerWindow = (long)(windowDurationMillis / 1000.0 * maxEventsPerSecond);
  logger.debug("max-events per-second {} per-window {}", maxEventsPerSecond, maxEventsPerWindow);

  try {
    eventloop = new DefaultEventLoop("EventLoop-" + context.getId());
    eventloop.start();
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:16,代码来源:AbstractFlumeInputOperator.java

示例6: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
 * Implement Component Interface.
 *
 * @param context
 */
@Override
public void setup(OperatorContext context)
{
  this.context = context;
  try {
    KinesisUtil.getInstance().createKinesisClient(accessKey, secretKey, endPoint);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  consumer.create();
  operatorId = context.getId();
  windowDataManager.setup(context);
  shardPosition.clear();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:20,代码来源:AbstractKinesisInputOperator.java

示例7: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  this.operatorContextId = context.getId();
  holdingBuffer = new ArrayBlockingQueue<KeyValPair<Long, byte[]>>(bufferSize);
  this.windowDataManager.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:8,代码来源:AbstractRabbitMQInputOperator.java

示例8: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  super.setup(context);

  mode = context.getValue(OperatorContext.PROCESSING_MODE);

  if (mode == ProcessingMode.AT_MOST_ONCE) {
    //Batch must be cleared to avoid writing same data twice
    tuples.clear();
  }

  try {
    for (T tempTuple: tuples) {
      setStatementParameters(updateCommand, tempTuple);
      updateCommand.addBatch();
    }
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }

  appId = context.getValue(DAG.APPLICATION_ID);
  operatorId = context.getId();
  //Get the last completed window.
  committedWindowId = store.getCommittedWindowId(appId, operatorId);
  LOG.debug("AppId {} OperatorId {}", appId, operatorId);
  LOG.debug("Committed window id {}", committedWindowId);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:29,代码来源:AbstractJdbcNonTransactionableBatchOutputOperator.java

示例9: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  try {
    store.connect();
    appId = context.getValue(DAG.APPLICATION_ID);
    operatorId = context.getId();
    committedWindowId = store.getCommittedWindowId(appId, operatorId);
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:13,代码来源:AbstractTransactionableStoreOutputOperator.java

示例10: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext ctxt)
{
  operatorId = ctxt.getId();
  appId = ctxt.getValue(DAGContext.APPLICATION_ID);
  String v = get(getEndWindowKey());
  if (v != null) {
    committedWindowId = Long.valueOf(v);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:AbstractKeyValueStoreOutputOperator.java

示例11: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  operatorId = context.getId();
  globalProcessedFileCount.setValue(processedFiles.size());
  LOG.debug("Setup processed file count: {}", globalProcessedFileCount);
  this.context = context;

  try {
    filePath = new Path(directory);
    configuration = new Configuration();
    fs = getFSInstance();
  } catch (IOException ex) {
    failureHandling(ex);
  }

  fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount);
  fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount);
  fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures);
  fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures);
  fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries);
  fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries);
  fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount);

  windowDataManager.setup(context);
  if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) {
    //reset current file and offset in case of replay
    currentFile = null;
    offset = 0;
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:32,代码来源:AbstractFileInputOperator.java

示例12: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
 * Initializing current partition id, partitionedFileName etc. {@inheritDoc}
 */
@Override
public void setup(OperatorContext context)
{
  super.setup(context);
  physicalPartitionId = context.getId();
  if (StringUtils.isEmpty(partitionedFileNameformat)) {
    partitionedFileName = outputFileName;
  } else {
    partitionedFileName = String.format(partitionedFileNameformat, outputFileName, physicalPartitionId);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:15,代码来源:AbstractSingleFileOutputOperator.java

示例13: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  if (PubSubHelper.isGatewayConfigured(context)) {
    wsoo.setUri(PubSubHelper.getURI(context));
    wsoo.setup(context);
  } else {
    isWebSocketConnected = false;
    coo.setup(context);
  }
  appId = context.getValue(DAG.APPLICATION_ID);
  operId = context.getId();

}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:15,代码来源:WidgetOutputOperator.java

示例14: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  this.operatorId = context.getId();
}
 
开发者ID:apache,项目名称:apex-core,代码行数:6,代码来源:PartitioningTest.java

示例15: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  super.setup(context);
  id = context.getId();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:7,代码来源:HDFSOutputOperator.java


注:本文中的com.datatorrent.api.Context.OperatorContext.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。