Java VM Restart

We’re using the python wrapper to start an orekit java VM on our backend. However, since our application can run for long periods of time, there is a need for us to refresh the orekit VM to always get the most up to date data.

We’ve tried a couple things to make this happen, none of which are able to properly clear the cache and pull in the new data. Generally, the way we are doing this was to just run setup_orekit_curdir(filename=path) on an interval where path is an fileshare that gets new/modified data.

We then tried to deconstruct that helper function to ensure that 1). Our test data is getting passed to the crawler and 2). when we add the provider with the crawler, then that new data propagated to the vm. Which we have looking something like this:

    if not orekit_vm:"Initializing orekit")
        orekit_vm = orekit.initVM()
    else:"Refreshing orekit")
    DM = DataContext.getDefault().getDataProvidersManager()
    data = File(path_to_orekit_data_folder)
    crawler = DirectoryCrawler(data)
    providers = DM.getProviders()
    for provider in providers:"Removing: {provider}")



Is there something we’re missing to fully clear the cache? Or is our only option just to fully destroy/restart the JavaVM?

You can look in the unit tests folders. There is a file that provides way to really clear everything. We refrained from putting this into the library itself, because it breaks many assumptions, so its use must really be limited to specific cases. It also relies a lot on introspection, so is difficult to maintain.

1 Like

My recommendation would be to not use the default data context. That way you can explicitly control what data each piece of code should use and when the data should be updated. See Orekit – Data contexts