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

Missing sync call in nio backend #131

Open
rmannibucau opened this issue Jun 11, 2019 · 1 comment
Open

Missing sync call in nio backend #131

rmannibucau opened this issue Jun 11, 2019 · 1 comment

Comments

@rmannibucau
Copy link

Hi,

I think NioBackend should get a sync call even if the future is not set in close otherwise I'm not sure how a readOnly=false instance should sync itself.

Shouldn't it be:

@Override
public synchronized void close() throws IOException {
    // cancel synchronization
    try {
        if (syncRunnableHandle != null) {
            syncRunnableHandle.cancel(false);
            syncRunnableHandle = null;
        }
        if (!readOnly) {
            sync();
        }
        unmapFile();
    } finally {
        file.close();
        super.close();
    }
}

?

Romain

@fbacchella
Copy link
Member

sync is not called when the syncRunnableHandle is not provided, because it means the user trusts the OS to do what is needed to flush the data in an enough secure way. So no special care is done in that case.

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

No branches or pull requests

2 participants