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


Java OperatorContext.getValue方法代码示例

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


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

示例1: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  OutputPort<?> unifierOutputPort = getOutputPort();
  unifierOutputPort.setSink(
      new Sink<Object>()
      {
        @Override
        public void put(Object tuple)
        {
          outputPort.emit(tuple);
        }

        @Override
        public int getCount(boolean reset)
        {
          return 0;
        }
      }
  );
  unifier.setup(context);
  spinMillis = context.getValue(OperatorContext.SPIN_MILLIS);
}
 
开发者ID:apache,项目名称:apex-core,代码行数:24,代码来源:Slider.java

示例2: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  super.setup(context);
  sleepTimeMillis = context.getValue(context.SPIN_MILLIS);
  getWindowDataManager().setup(context);
  this.context = context;
  scanOffset = 0;
  scanComplete = false;
  scanParameters = new ScanParams();
  scanParameters.count(scanCount);

  // For the 1st window after checkpoint, windowID - 1 would not have recovery
  // offset stored in windowDataManager
  // But recoveryOffset is non-transient, so will be recovered with
  // checkPointing
  // Offset recovery from idempotency storage can be skipped in this case
  scanOffset = recoveryState.scanOffsetAtBeginWindow;
  skipOffsetRecovery = true;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:21,代码来源:AbstractRedisInputOperator.java

示例3: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setup(OperatorContext context)
{
  ProcessingMode mode = context.getValue(OperatorContext.PROCESSING_MODE);
  if (mode == ProcessingMode.AT_MOST_ONCE) {
    //map must be cleared to avoid writing same data twice
    if (numTuples == 0) {
      mapTuples.clear();
    }
  }
  numTuples = 0;
  //atleast once, check leftovers in map and send them to couchbase.
  if (!mapTuples.isEmpty()) {
    Iterator<?> itr = mapTuples.values().iterator();
    while (itr.hasNext()) {
      processTuple((T)itr.next());
    }
  }
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:22,代码来源:AbstractCouchBaseOutputOperator.java

示例4: uriHelper

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
public static URI uriHelper(OperatorContext context, URI uri)
{
  if (uri == null) {
    if (context.getValue(DAG.GATEWAY_CONNECT_ADDRESS) == null) {
      throw new IllegalArgumentException("The uri property is not set and the dt.attr.GATEWAY_CONNECT_ADDRESS is not defined");
    }

    try {
      uri = PubSubHelper.getURI(context);
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }

  return uri;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:17,代码来源:PubSubWebSocketAppDataQuery.java

示例5: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  this.context = context;
  this.currentWindow = context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID);
  sleepTimeMillis = context.getValue(OperatorContext.SPIN_MILLIS);

  bucketManager.setBucketCounters(counters);
  counters.setCounter(CounterKeys.DUPLICATE_EVENTS, new MutableLong());

  bucketManager.startService(this);
  logger.debug("bucket keys at startup {}", waitingEvents.keySet());
  for (long bucketKey : waitingEvents.keySet()) {
    bucketManager.loadBucketData(bucketKey);
  }
  if (orderedOutput) {
    decisions = Maps.newLinkedHashMap();
  }
}
 
开发者ID:DataTorrent,项目名称:Megh,代码行数:20,代码来源:AbstractDeduper.java

示例6: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  this.context = context;
  spinMillis = context.getValue(OperatorContext.SPIN_MILLIS);
  counters.setCounter(CounterKeys.RECEIVED, new MutableLong());
  counters.setCounter(CounterKeys.REDELIVERED, new MutableLong());
  windowDataManager.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:10,代码来源:AbstractJMSInputOperator.java

示例7: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  contextId = context.getValue(DAGContext.APPLICATION_NAME);
  outputFileName = File.separator + contextId +
                   File.separator + "transactions.out.part";
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:9,代码来源:HdfsStringOutputOperator.java

示例8: 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

示例9: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  mode = context.getValue(context.PROCESSING_MODE);
  if (mode == ProcessingMode.EXACTLY_ONCE) {
    throw new RuntimeException("This operator only supports atmost once and atleast once processing modes");
  }
  if (mode == ProcessingMode.AT_MOST_ONCE) {
    tuples.clear();
  }
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:13,代码来源:AbstractAccumuloOutputOperator.java

示例10: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  mode = context.getValue(OperatorContext.PROCESSING_MODE);
  if (mode == ProcessingMode.EXACTLY_ONCE) {
    throw new RuntimeException("This operator only supports atmost once and atleast once processing modes");
  }
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:10,代码来源:AbstractHBaseWindowAppendOutputOperator.java

示例11: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
  mode = context.getValue(context.PROCESSING_MODE);
  if (mode == ProcessingMode.EXACTLY_ONCE) {
    throw new RuntimeException("This operator only supports atmost once and atleast once processing modes");
  }
  super.setup(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:10,代码来源:AbstractHBaseWindowPutOutputOperator.java

示例12: setup

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext arg0)
{
  if (arg0 != null) {
    applicationWindowSize = arg0.getValue(OperatorContext.APPLICATION_WINDOW_COUNT);
  }
  if (cacheOject == null) {
    cacheOject = new HashMap<Integer, Map<String, Map<String, Number>>>(windowSize);
  }
  if (outputMap == null) {
    outputMap = new HashMap<String, Map<String, KeyValPair<MutableDouble, Integer>>>();
  }
  setUpPatternList();

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

示例13: activate

import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void activate(OperatorContext context)
{
  long largestRecoveryWindow = windowManager.getLargestCompletedWindow();
  if (largestRecoveryWindow == Stateless.WINDOW_ID
      || context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) > largestRecoveryWindow) {
    initializePreparedStatement();
    schedulePollTask();
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:AbstractJdbcPollInputOperator.java

示例14: 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

示例15: 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


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