Hi all,
I've a Flink job that initialize a static Map in the main program, before
starting any Flink transformation. If I run the job locally that variable
is not empty, running the job on the cluster reset that variable..is it a
bug or am I doing something wrong?
It only works if I initialize that variable in a static statement before
the main, that is:

///////////////// KO EXAMPLE
class ErrorMain {

    private static final Map<String,String> ht = new HashMap<>();

    publis static final main(String[]args){
     ht.put("test","test");
     env.readFile().map(
        ...
       //here ht.get("test") returns null
  }
}

///////////////// OK EXAMPLE
class OkMain {

    private static final Map<String,String> ht = new HashMap<>();
    static{
        ht.put("test","test");
    }
    publis static final main(String[] args){

     env.readFile().map(
        ...
       //here ht.get("test") works
  }
}


Best,
Flavio

Reply via email to