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

Release lock if the originating process is gone #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Release lock if the originating process is gone #22

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 5, 2015

This fix checks if the IP of the current machine is the same that the IP of the server that acquired the lock. if we are on the same machine, but the originating process doesn't exists anymore, it assumes we can safely release the lock and return false (aka, lock is not locked).

Caveat : If the lock has been acquired by a process on pc-01, but the process failed to release the lock, no other machine will be able to acquire the same lock until a new process on pc-01 will call the isLocked() method again.

This fix checks if the IP of the current machine is the same that the IP of the server that acquired the lock. if we are on the same machine, but the originating process doesn't exists anymore, it assumes we can safely release the lock and return false (aka, lock is not locked).

Caveat : If the lock has been acquired by a process on pc-01, but the process failed to release the lock, no other machine will be able to acquire the same lock until a new process on pc-01 will call the isLocked() method again.
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 this pull request may close these issues.

1 participant