本文整理匯總了Java中com.hazelcast.jet.JetInstance.getList方法的典型用法代碼示例。如果您正苦於以下問題:Java JetInstance.getList方法的具體用法?Java JetInstance.getList怎麽用?Java JetInstance.getList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hazelcast.jet.JetInstance
的用法示例。
在下文中一共展示了JetInstance.getList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runTest
import com.hazelcast.jet.JetInstance; //導入方法依賴的package包/類
private void runTest(List<Long> sourceItems, Long expectedOutput)
throws Exception {
JetInstance instance = createJetMember();
AggregateOperation1<Long, ?, Long> summingOp = summingLong((Long l) -> l);
DAG dag = new DAG();
Vertex source = dag.newVertex("source", () -> new ListSource(sourceItems)).localParallelism(1);
Vertex sink = dag.newVertex("sink", writeListP("sink"));
if (singleStageProcessor) {
Vertex aggregate = dag.newVertex("aggregate", aggregateP(summingOp))
.localParallelism(1);
dag
.edge(between(source, aggregate).distributed().allToOne())
.edge(between(aggregate, sink).isolated());
} else {
Vertex accumulate = dag.newVertex("accumulate", accumulateP(summingOp));
Vertex combine = dag.newVertex("combine", combineP(summingOp)).localParallelism(1);
dag
.edge(between(source, accumulate))
.edge(between(accumulate, combine).distributed().allToOne())
.edge(between(combine, sink).isolated());
}
instance.newJob(dag).join();
IList<Long> sinkList = instance.getList("sink");
assertEquals(singletonList(expectedOutput), new ArrayList<>(sinkList));
// wait a little more and make sure, that there are no more frames
Thread.sleep(1000);
assertEquals(singletonList(expectedOutput), new ArrayList<>(sinkList));
assertEquals(expectedOutput, sinkList.get(0));
}
示例2: getList
import com.hazelcast.jet.JetInstance; //導入方法依賴的package包/類
protected static <E> IStreamList<E> getList(JetInstance instance) {
return instance.getList(randomName());
}
示例3: testWriteFile
import com.hazelcast.jet.JetInstance; //導入方法依賴的package包/類
@Test
public void testWriteFile() throws Exception {
int messageCount = 20;
String mapName = randomMapName();
JetInstance instance = createJetMember();
createJetMember();
Map<IntWritable, IntWritable> map = IntStream.range(0, messageCount).boxed()
.collect(toMap(IntWritable::new, IntWritable::new));
instance.getMap(mapName).putAll(map);
DAG dag = new DAG();
Vertex producer = dag.newVertex("producer", readMapP(mapName))
.localParallelism(1);
Path path = getPath();
JobConf conf = new JobConf();
conf.setOutputFormat(outputFormatClass);
conf.setOutputCommitter(FileOutputCommitter.class);
conf.setOutputKeyClass(IntWritable.class);
conf.setOutputValueClass(IntWritable.class);
FileOutputFormat.setOutputPath(conf, path);
Vertex consumer = dag.newVertex("consumer",
HdfsProcessors.<Entry<IntWritable, IntWritable>, IntWritable, IntWritable>writeHdfsP(
conf, Entry::getKey, Entry::getValue))
.localParallelism(4);
dag.edge(between(producer, consumer));
Future<Void> future = instance.newJob(dag).getFuture();
assertCompletesEventually(future);
dag = new DAG();
JobConf readJobConf = new JobConf();
readJobConf.setInputFormat(inputFormatClass);
FileInputFormat.addInputPath(readJobConf, path);
producer = dag.newVertex("producer", readHdfsP(readJobConf, Util::entry))
.localParallelism(8);
consumer = dag.newVertex("consumer", writeListP("results"))
.localParallelism(1);
dag.edge(between(producer, consumer));
future = instance.newJob(dag).getFuture();
assertCompletesEventually(future);
IList<Object> results = instance.getList("results");
assertEquals(messageCount, results.size());
}