maxmind / geoipupdate-legacy

GeoIP update client code
GNU General Public License v2.0
258 stars 63 forks source link

Will automatic update work and update the file at the same time when my program is reading GeoLite2-Country.mmdb #49

Closed umesh-mehta closed 8 years ago

umesh-mehta commented 8 years ago

My program will be reading GeoLite2-Country.mmdb from the location where automatic update has been set, So my question is Will automatic update work and update the file at the same time when my program is reading GeoLite2-Country.mmdb ??

@PostConstruct
    public void init()
    {
        try
        {
            LOG.info("Trying to load maxmind GeoLite2-Country database...");

            final Resource resource = resourceLoader.getResource(FILE + Config.getParameter(DATABASE_PATH));
            final File db = resource.getFile();

            reader = new DatabaseReader.Builder(db).build();

            LOG.info("Maxmind database was loaded successfully.");

        }
        catch (IOException | NullPointerException e)
        {
            LOG.error("Error maxmind database reader cound not be initialized. ", e);
        }
    }
oschwald commented 8 years ago

Yes, that should be fine on unix-like systems. The new file is moved over the old file and any process using the old file should be able to continue using it.