|
38 | 38 | import org.apache.flink.streaming.api.functions.async.ResultFuture; |
39 | 39 | import org.apache.flink.streaming.api.functions.async.RichAsyncFunction; |
40 | 40 | import org.apache.flink.streaming.api.operators.StreamingRuntimeContext; |
41 | | -import org.apache.flink.streaming.api.operators.async.AsyncWaitOperator; |
42 | 41 | import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback; |
43 | 42 | import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService; |
44 | | -import org.apache.flink.table.typeutils.TimeIndicatorTypeInfo; |
| 43 | +import org.apache.flink.table.api.DataTypes; |
45 | 44 | import org.apache.flink.types.Row; |
46 | 45 | import org.slf4j.Logger; |
47 | 46 | import org.slf4j.LoggerFactory; |
|
53 | 52 | import java.util.Collections; |
54 | 53 | import java.util.List; |
55 | 54 | import java.util.Map; |
56 | | -import java.util.concurrent.LinkedBlockingQueue; |
57 | 55 | import java.util.concurrent.ScheduledFuture; |
58 | | -import java.util.concurrent.ThreadPoolExecutor; |
59 | | -import java.util.concurrent.TimeUnit; |
60 | 56 |
|
61 | 57 | /** |
62 | 58 | * All interfaces inherit naming rules: type + "AsyncReqRow" such as == "MysqlAsyncReqRow |
@@ -114,7 +110,7 @@ private void initMetric() { |
114 | 110 |
|
115 | 111 |
|
116 | 112 | protected Object convertTimeIndictorTypeInfo(Integer index, Object obj) { |
117 | | - boolean isTimeIndicatorTypeInfo = TimeIndicatorTypeInfo.class.isAssignableFrom(sideInfo.getRowTypeInfo().getTypeAt(index).getClass()); |
| 113 | + boolean isTimeIndicatorTypeInfo = DataTypes.class.isAssignableFrom(sideInfo.getRowTypeInfo().getTypeAt(index).getClass()); |
118 | 114 |
|
119 | 115 | //Type information for indicating event or processing time. However, it behaves like a regular SQL timestamp but is serialized as Long. |
120 | 116 | if (obj instanceof LocalDateTime && isTimeIndicatorTypeInfo) { |
@@ -257,19 +253,15 @@ protected ScheduledFuture<?> registerTimer(Tuple2<Boolean,Row> input, ResultFutu |
257 | 253 | long timeoutTimestamp = sideInfo.getSideTableInfo().getAsyncTimeout() + getProcessingTimeService().getCurrentProcessingTime(); |
258 | 254 | return getProcessingTimeService().registerTimer( |
259 | 255 | timeoutTimestamp, |
260 | | - new ProcessingTimeCallback() { |
261 | | - @Override |
262 | | - public void onProcessingTime(long timestamp) throws Exception { |
263 | | - timeout(input, resultFuture); |
264 | | - } |
265 | | - }); |
| 256 | + timestamp -> timeout(input, resultFuture)); |
266 | 257 | } |
267 | 258 |
|
268 | 259 | protected void registerTimerAndAddToHandler(Tuple2<Boolean,Row> input, ResultFuture<Tuple2<Boolean,Row>> resultFuture) |
269 | 260 | throws InvocationTargetException, IllegalAccessException { |
270 | 261 | ScheduledFuture<?> timeFuture = registerTimer(input, resultFuture); |
271 | 262 | // resultFuture 是ResultHandler 的实例 |
272 | 263 | Method setTimeoutTimer = ReflectionUtils.getDeclaredMethod(resultFuture, "setTimeoutTimer", ScheduledFuture.class); |
| 264 | + setTimeoutTimer.setAccessible(true); |
273 | 265 | setTimeoutTimer.invoke(resultFuture, timeFuture); |
274 | 266 | } |
275 | 267 |
|
|
0 commit comments