Github user pnowojski commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6081#discussion_r195011678
  
    --- Diff: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
 ---
    @@ -1239,6 +1286,50 @@ protected void cancelTask() throws Exception {
     
        }
     
    +   /**
    +    * A task that register a processing time service callback.
    +    */
    +   public static class TimeServiceTask extends StreamTask<String, 
AbstractStreamOperator<String>> {
    +
    +           public TimeServiceTask(Environment env) {
    +                   super(env, null);
    +           }
    +
    +           @Override
    +           protected void init() throws Exception {
    +                   getProcessingTimeService().registerTimer(1000, new 
ProcessingTimeCallback() {
    +                           @Override
    +                           public void onProcessingTime(long timestamp) 
throws Exception {
    +                                   
classLoaders.add(Thread.currentThread().getContextClassLoader());
    +                           }
    +                   });
    +           }
    +
    +           @Override
    +           protected void run() throws Exception {
    --- End diff --
    
    The test is failing on the travis. Probably because here in `run()` you do 
not wait for at least one execution of `onProcessingTime(...)`. Probably you 
need to add a `OneShotLatch` and `tigger` it in `onProcessingTime` while 
`await`'ing in `run()`.


---

Reply via email to