本文整理汇总了Java中com.datatorrent.common.util.BaseOperator类的典型用法代码示例。如果您正苦于以下问题:Java BaseOperator类的具体用法?Java BaseOperator怎么用?Java BaseOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseOperator类属于com.datatorrent.common.util包,在下文中一共展示了BaseOperator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: emitTuples
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void emitTuples()
{
if (testTuples == null || testTuples.isEmpty()) {
if (blockEndStream) {
return;
}
BaseOperator.shutdown();
}
if (first) {
List<T> tuples = testTuples.remove(0);
for (T t: tuples) {
output.emit(t);
LOG.debug("sent tuple ==={}===", t);
}
first = false;
}
}
开发者ID:apache,项目名称:apex-core,代码行数:20,代码来源:PartitioningTest.java
示例2: testArraySerialization
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Test
public void testArraySerialization() throws Exception
{
OperatorDiscoverer od = new OperatorDiscoverer();
Assert.assertNotNull(od.getOperatorClass(BaseOperator.class.getName()));
JSONObject desc = od.describeClass(ArraysHolder.class);
String debugInfo = "\ntype info for " + ArraysHolder.class + ":\n" + desc.toString(2) + "\n";
JSONArray props = desc.getJSONArray("properties");
ArraysHolder ah = new ArraysHolder();
JSONObject beanArray = getJSONProperty(props, "beanArray");
Assert.assertEquals(debugInfo + "type " + ah.beanArray.getClass(), ah.beanArray.getClass().getName(), beanArray.get("type"));
JSONObject intArray = getJSONProperty(props, "intArray");
Assert.assertEquals(debugInfo + "type " + ah.intArray.getClass(), ah.intArray.getClass().getName(), intArray.get("type"));
ObjectMapper mapper = ObjectMapperFactory.getOperatorValueSerializer();
String s = mapper.writeValueAsString(ah);
ArraysHolder clone = mapper.readValue(s, ArraysHolder.class);
Assert.assertNotNull(clone.intArray);
Assert.assertArrayEquals(ah.intArray, clone.intArray);
}
开发者ID:apache,项目名称:apex-core,代码行数:26,代码来源:OperatorDiscoveryTest.java
示例3: emitTuples
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void emitTuples()
{
int lstart = s_start;
int lend = s_end;
if (lstart < lend) {
for (int i = lstart; i < lend; i++) {
emitTuple(i);
}
} else {
for (int i = lstart; i > lend; i--) {
emitTuple(i);
}
}
// done generating data
LOG.info("Finished generating data.");
BaseOperator.shutdown();
}
开发者ID:apache,项目名称:apex-malhar,代码行数:20,代码来源:SeedEventGenerator.java
示例4: endWindow
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void endWindow() {
if (outputWatermark >= BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()) {
// terminate the stream
if (traceTuples) {
LOG.debug("terminating input after final watermark");
}
try {
// see BEAM-1140 for why the delay after mark was emitted
Thread.sleep(100);
} catch (InterruptedException e) {
}
BaseOperator.shutdown();
}
}
开发者ID:apache,项目名称:beam,代码行数:16,代码来源:ApexReadUnboundedInputOperator.java
示例5: beginWindow
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void beginWindow(long windowId)
{
if (++windowCount == 3) {
BaseOperator.shutdown();
}
}
开发者ID:apache,项目名称:apex-core,代码行数:8,代码来源:CheckpointTest.java
示例6: committed
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void committed(long windowId)
{
logger.debug("{}, windowId={}", this, Codec.getStringWindowId(windowId));
if (simulateFailure && firstRun && checkpointedWindowId > 0 && windowId > checkpointedWindowId) {
throw new RuntimeException("Failure Simulation from " + this);
}
// we have emitted enough tuples and we have tested recovery, so we can shutdown once we have emitted enough.
if (maximumTuples == 0) {
BaseOperator.shutdown();
}
}
开发者ID:apache,项目名称:apex-core,代码行数:14,代码来源:RecoverableInputOperator.java
示例7: beginWindow
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void beginWindow(long windowId)
{
if (shutdown) {
BaseOperator.shutdown();
}
this.windowId = windowId;
}
开发者ID:apache,项目名称:apex-core,代码行数:9,代码来源:StatsTest.java
示例8: emitTuples
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void emitTuples()
{
Object tuple;
while ((tuple = this.externallyAddedTuples.poll()) != null) {
outport.emit(tuple);
}
if (remainingSleepTime > 0) {
try {
Thread.sleep(spinMillis);
remainingSleepTime -= spinMillis;
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
} else if (maxTuples != 0) {
generatedTuples++;
LOG.debug("sending tuple " + generatedTuples);
outport.emit(String.valueOf(generatedTuples));
if (maxTuples > 0 && maxTuples <= generatedTuples) {
BaseOperator.shutdown();
throw new RuntimeException(new InterruptedException("done emitting all."));
}
remainingSleepTime = emitInterval;
} else {
remainingSleepTime = emitInterval;
}
}
开发者ID:apache,项目名称:apex-core,代码行数:29,代码来源:TestGeneratorInputOperator.java
示例9: FailableOperator
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@SuppressWarnings("SameParameterValue")
FailableOperator(BaseOperator baseOperator, int windows, boolean afterCommit)
{
failureSimulated = false;
this.baseOperator = baseOperator.getClass().getSimpleName();
this.simulateFailureWindows = windows;
this.simulateFailureAfterCommit = afterCommit;
}
开发者ID:apache,项目名称:apex-core,代码行数:9,代码来源:DelayOperatorTest.java
示例10: endWindow
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void endWindow()
{
assert (threadId == Thread.currentThread().getId());
BaseOperator.shutdown();
}
开发者ID:apache,项目名称:apex-core,代码行数:7,代码来源:OiOStreamTest.java
示例11: emitTuples
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Override
public void emitTuples()
{
BaseOperator.shutdown();
}
开发者ID:apache,项目名称:apex-core,代码行数:6,代码来源:OiOEndWindowTest.java
示例12: testNullOperatorName
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testNullOperatorName()
{
dag.addOperator(null, BaseOperator.class);
}
开发者ID:apache,项目名称:apex-core,代码行数:6,代码来源:LogicalPlanTest.java
示例13: testEmptyOperatorName
import com.datatorrent.common.util.BaseOperator; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testEmptyOperatorName()
{
dag.addOperator("", BaseOperator.class);
}
开发者ID:apache,项目名称:apex-core,代码行数:6,代码来源:LogicalPlanTest.java
注:本文中的com.datatorrent.common.util.BaseOperator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论