本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
}
示例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);
}
示例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);
}
}