Hi,

I have a requirement to initialize few guava caches per jvm and some static
helper classes. I tried few options but nothing worked. Need some help.
Thanks a lot.

1. Operator level static variables:

public static Cache<String, String> loadingCache;

public void open(Configuration parameters) throws Exception {
if (loadingCache == null)
initializeCache();
}

The cache object is null on each operator slot and it gets initialized on
every call to open method.

2. Initialize in operator class constructor:

public FlatMapFunction(ParameterTool parameterTool) {
        this. parameterTool = parameterTool;
        initializeCache();
}

The cache doesn't seem to be initialized when accessed inside the task
manager.

Thanks.

Reply via email to