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

fix: use local TimestampUtil in PgStatement and PgResultset for thread safety #2291

Merged
merged 3 commits into from
Nov 10, 2021

Conversation

marcmuel
Copy link
Contributor

@marcmuel marcmuel commented Oct 8, 2021

TimestampUtil is not thread safe. It raises exeptions when multiple
Threads use ResultSets of one
connection. If PgStatement and PgResultSet use their own TimestampUtil
no synchronize is needed.

Issue: fix: synchronize modification of shared calendar (#921)

safety

TimestampUtil is not thread safe. It raises exeptions when multiple
Threads use ResultSets of one
connection. If PgStatement and PgResultSet use their own TimestampUtil
no
synchronize is needed.

This belongs to Issue fix: synchronize modification of shared calendar
(pgjdbc#921)
@davecramer
Copy link
Member

@marcmuel can you fix up the null check issues please ?

@davecramer
Copy link
Member

I can commit if you check the box which allows maintainers to commit to this PR

@davecramer
Copy link
Member

timestampUtils = new TimestampUtils(! connection.getQueryExecutor().getIntegerDateTimes(), (Provider<TimeZone>) new QueryExecutorTimeZoneProvider(connection.getQueryExecutor()));
and
timestampUtils = new TimestampUtils(! connection.getQueryExecutor().getIntegerDateTimes(), (Provider< TimeZone>)new QueryExecutorTimeZoneProvider(connection.getQueryExecutor()));

fixes this.

@marcmuel
Copy link
Contributor Author

marcmuel commented Nov 8, 2021

OK. I added your changes. Thanks.

@marcmuel
Copy link
Contributor Author

marcmuel commented Nov 9, 2021

"Allow edits by maintainers" is alredy checked.

@davecramer
Copy link
Member

couple small fixes in style and we are good to to...

@marcmuel
Copy link
Contributor Author

marcmuel commented Nov 9, 2021

ok. I did it.

@davecramer davecramer merged commit fb31518 into pgjdbc:master Nov 10, 2021
@vlsi
Copy link
Member

vlsi commented Jan 26, 2022

@marcmuel , @tordmjohnson, I am afraid this change does not really solve #921

A single TimestampUtil instance per-ResultSet is still not enough to make it safe concurrent operations on a single ResultSet instance from multiple threads.

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.

3 participants