提交 d74869f8 编写于 作者: X Xingcan Cui 提交者: Fabian Hueske

[FLINK-8278] [docs] Fix Scala examples of metrics docs (var initialization).

上级 edf10c71
......@@ -397,7 +397,7 @@ class BufferingSink(threshold: Int = 0)
with CheckpointedRestoring[List[(String, Int)]] {
@transient
private var checkpointedState: ListState[(String, Int)] = null
private var checkpointedState: ListState[(String, Int)] = _
private val bufferedElements = ListBuffer[(String, Int)]()
......
......@@ -69,7 +69,7 @@ public class MyMapper extends RichMapFunction<String, String> {
{% highlight scala %}
class MyMapper extends RichMapFunction[String,String] {
@transient private var counter: Counter
@transient private var counter: Counter = _
override def open(parameters: Configuration): Unit = {
counter = getRuntimeContext()
......@@ -119,7 +119,7 @@ public class MyMapper extends RichMapFunction<String, String> {
{% highlight scala %}
class MyMapper extends RichMapFunction[String,String] {
@transient private var counter: Counter
@transient private var counter: Counter = _
override def open(parameters: Configuration): Unit = {
counter = getRuntimeContext()
......@@ -229,7 +229,7 @@ public class MyMapper extends RichMapFunction<Long, Long> {
{% highlight scala %}
class MyMapper extends RichMapFunction[Long,Long] {
@transient private var histogram: Histogram
@transient private var histogram: Histogram = _
override def open(parameters: Configuration): Unit = {
histogram = getRuntimeContext()
......@@ -289,7 +289,7 @@ public class MyMapper extends RichMapFunction<Long, Long> {
{% highlight scala %}
class MyMapper extends RichMapFunction[Long, Long] {
@transient private var histogram: Histogram
@transient private var histogram: Histogram = _
override def open(config: Configuration): Unit = {
com.codahale.metrics.Histogram dropwizardHistogram =
......@@ -342,7 +342,7 @@ public class MyMapper extends RichMapFunction<Long, Long> {
{% highlight scala %}
class MyMapper extends RichMapFunction[Long,Long] {
@transient private var meter: Meter
@transient private var meter: Meter = _
override def open(config: Configuration): Unit = {
meter = getRuntimeContext()
......@@ -401,7 +401,7 @@ public class MyMapper extends RichMapFunction<Long, Long> {
{% highlight scala %}
class MyMapper extends RichMapFunction[Long,Long] {
@transient private var meter: Meter
@transient private var meter: Meter = _
override def open(config: Configuration): Unit = {
com.codahale.metrics.Meter dropwizardMeter = new com.codahale.metrics.Meter()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册