Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Connection mutex improvements for issue #59 #63

Merged
merged 3 commits into from
Nov 6, 2013
Merged

Conversation

dylex
Copy link
Contributor

@dylex dylex commented Nov 6, 2013

(I don't see how to connect a PR with an existing issue.) See comments on #59.

dylex added 3 commits November 3, 2013 17:45
Race conditions should be properly caught, but will still throw a
ConnectionStillRunningQueryException.  Basically this just involves making
setQueryPromise check for an existing promise and reordering operations to
happen within this mutex.  readyForQuery is no longer necessary as it is fully
redundant with queryPromise.  For Issue mauricio#59.
Use the same approach as in PostgreSQLConnection, where queryPromise is an
AtomicReference.  Previously it would check queryPromise.isComplete.  However,
there was no way that a non-null promise could be complete as the only two
places it was completed (in {succeed,fail}QueryPromise) immediately set it to
null beforehand.  This should be reviewed/tested.  Issue mauricio#59.

Updated clearQueryPromise in both to return the old promise, in order to avoid
racing completions.
mauricio added a commit that referenced this pull request Nov 6, 2013
Connection mutex improvements for issue #59
@mauricio mauricio merged commit ac8382d into mauricio:master Nov 6, 2013
@dylex dylex deleted the mutex branch November 6, 2013 19:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants