Expose PID of the backend process serving a paricular JDBC connection

I'm chasing a deadlock problem in my application occurring once per several million transactions. Before I start blaming the database, I want to make sure that my application is not doing something stupid. For that I need to keep track of Java thread - PostgresSQL backend worker association.
I know I can push information about the thread using a connection to PostgreSQL 9.0+ using setClientInfo but it is more convenient for me to put information about associated backend PID into the logs produced on Java side - I'm saving myself the effort needed to correlate the two log streams with one another.
The information about PID was already there, in ProtocolConnection (both v2 and v3) so the only thing I needed was exposing that information through PGConnection interface. I'm running a patched 9.1 driver now and it works great, so I thought that I'll share the patch - perhaps other users will also find it useful.