Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChronicleMap flag skipCloseOnExitHook gets reset to false when loading map from and existing file #213

Open
mrbald opened this issue Mar 27, 2020 · 4 comments

Comments

@mrbald
Copy link

mrbald commented Mar 27, 2020

The flag added in the PR 184 does not survive close/open.
When opening an existing file it uses the default value from the map unmarshaller.

I found it quite confusing (and I don't think it has been mentioned clearly in the docs) that the map persists the settings it has been created with, silently ignoring whatever is passed on the builder.
In my opinion the behavior should be biased towards "it's allowed to override behavior on re-open", because it would make binary releases with improved settings easier.

@jazdw
Copy link

jazdw commented Jul 30, 2021

The skipCloseOnExitHook field is neither read nor written by the marshalller. There is no way to turn off the exit hook for an existing file.

@jazdw
Copy link

jazdw commented Jul 30, 2021

Work around:

            try {
                Class<?> closeOnExitHook = Class.forName("net.openhft.chronicle.hash.impl.ChronicleHashCloseOnExitHook");
                Method method = closeOnExitHook.getDeclaredMethod("remove", VanillaChronicleHash.class);
                method.setAccessible(true);
                //noinspection JavaReflectionInvocation
                method.invoke(null, this.database);
            } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
                log.warn("Failed to disable Chronicle Map exit hook", e);
            }

@agusevas
Copy link

agusevas commented Dec 5, 2021

@peter-lawrey are there any plans to fix this issue?

@RobAustin
Copy link
Member

It's on our backlog, if you would like it prioritised please contact sales@chronicle.software

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants