2016-09-26 73 views
1

不能使用计编译失败,则编译失败:弗林克:当我加计

def open(configuration: Configuration) { 
    getRuntimeContext() 
    .getMetricGroup() 
    .gauge("RecordConverter.latency", new Gauge[Int]() { 
     @Override 
     def getValue(): Int = { 
     return latency; 
     } 
    }); 
    } 

====================== ======================================

error: overloaded method value gauge with alternatives: 
[ERROR] [T, G <: org.apache.flink.metrics.Gauge[T]](x$1: String,x$2: G)G <and> 
[ERROR] [T, G <: org.apache.flink.metrics.Gauge[T]](x$1: Int, x$2: G)G 
[ERROR] cannot be applied to (String, org.apache.flink.metrics.Gauge[Int]) 
[ERROR]   .gauge("RecordConverter.latency", new Gauge[Int]() { 
[ERROR]  ^

回答

1

您必须明确设置类型如下:

.gauge[Int, Gauge[Int]]("RecordConverter.latency"...