Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Fri, 20 Oct 2017 15:20:44 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #943: fix: synchronize modification of shared calendar (#921) In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 338237662 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 943 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/943#issuecomment-338237662 Content-Type: text/plain; charset=utf-8 @tordmjohnson , the idea is as follows: shared calendar should not be used outside of a synchronized context. Things like the following should be simple. I bet just passing `null` should be enough (and remove the `if`) ``` if (cal == null) { cal = getDefaultCalendar(); } bindString(i, connection.getTimestampUtils().toString(cal, d), Oid.UNSPECIFIED); ``` org.postgresql.jdbc.PgResultSet#getDefaultCalendar is somewhat more involved. However idea is the same: since `Calendar` is not thread-safe, there should be some synchronization