flink观看更新
This commit is contained in:
parent
1f674b6b56
commit
6e66e33c27
|
|
@ -1,9 +1,9 @@
|
||||||
package day01.scala
|
package day01.scala
|
||||||
|
|
||||||
//import org.apache.flink.api.common.functions.FlatMapFunction
|
import org.apache.flink.api.common.functions.FlatMapFunction
|
||||||
//import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator
|
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator
|
||||||
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
|
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
|
||||||
//import org.apache.flink.util.Collector
|
import org.apache.flink.util.Collector
|
||||||
|
|
||||||
object Example_scala1 {
|
object Example_scala1 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,35 +58,35 @@ public class Example2 {
|
||||||
.print();
|
.print();
|
||||||
|
|
||||||
//匿名内部类的方式
|
//匿名内部类的方式
|
||||||
// env
|
env
|
||||||
// .addSource(new SourceFunction<Integer>() {
|
.addSource(new SourceFunction<Integer>() {
|
||||||
//
|
|
||||||
// private boolean running = true;
|
private boolean running = true;
|
||||||
// private Random random = new Random();
|
private Random random = new Random();
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void run(SourceContext<Integer> ctx) throws Exception {
|
public void run(SourceContext<Integer> ctx) throws Exception {
|
||||||
//
|
|
||||||
// while (running) {
|
while (running) {
|
||||||
// ctx.collect(random.nextInt(1000));
|
ctx.collect(random.nextInt(1000));
|
||||||
// Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void cancel() {
|
public void cancel() {
|
||||||
// running = false;
|
running = false;
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .map(new MapFunction<Integer, Tuple2<Integer, Integer>>() {
|
.map(new MapFunction<Integer, Tuple2<Integer, Integer>>() {
|
||||||
// @Override
|
@Override
|
||||||
// public Tuple2<Integer, Integer> map(Integer value) throws Exception {
|
public Tuple2<Integer, Integer> map(Integer value) throws Exception {
|
||||||
// return Tuple2.of(value, value);
|
return Tuple2.of(value, value);
|
||||||
// }
|
}
|
||||||
// }).print();
|
}).print();
|
||||||
|
|
||||||
|
|
||||||
//外部类的方式
|
//外部类的方式
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
|
||||||
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
|
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
|
||||||
import org.apache.flink.streaming.api.functions.source.SourceFunction;
|
import org.apache.flink.streaming.api.functions.source.SourceFunction;
|
||||||
import org.apache.flink.util.Collector;
|
import org.apache.flink.util.Collector;
|
||||||
import sun.awt.SunHints;
|
|
||||||
|
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
|
||||||
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
|
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
|
||||||
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
|
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
|
||||||
import org.apache.flink.util.Collector;
|
import org.apache.flink.util.Collector;
|
||||||
import sun.awt.geom.AreaOp;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue