agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] doubtful PL/Java's activity
Date: Thu, 12 Dec 2013 09:15:55 +0100
Message-ID: <52A970BB.8030904@tada.se> (raw)
In-Reply-To: <2AB2177C63D24C43AC3BDE9A3A8F71FC1C86280C@G01JPEXMBYT02>
References: <2AB2177C63D24C43AC3BDE9A3A8F71FC1C86280C@G01JPEXMBYT02>
PL/Java goes to some length in protecting the single threaded PostgreSQL kernel. All accesses to it must be made from
the caller thread. Multiple threads can be used for background tasks but such threads will be completely blocked from
accessing the PostgreSQL functions.
It works like this:
A call is made from PostgreSQL. This call grabs a mutex.
During PL/Java execution, only the thread that owns the mutex can call PostgreSQL.
When the call eventually returns, the mutex is released.
Java maintenance (garbage collection for instance) will still run in separate threads. If someone should write a
finalizer that actually tries to do database access (god forbid), then that finalizer would throw an exception.
- thomas
On 2013-12-09 12:16, Taniguchi, Yasunori wrote:
> Hi,
>
> I'm investigating PL/Java and find out a doubtful fact.
>
> Postgres is compiled as a single thread application
> and linked with JavaVM(.so/.dll) which is a multi thread library.
> Sp, I think PL/Java's activity may not be assured.
>
> Thread-unsafe functions and global variables used in single thread
> standard libraries may be inconsistent with multi thread libraries.
>
> Can anybody respond me ?
>
>
> Regards.
> -----
> Y.Taniguchi
>
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at lists.pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev
view thread (15+ messages) latest in thread
Message-ID: <52A970BB.8030904@tada.se>
Permalink: ../52A970BB.8030904@tada.se/
Also on: postgresql.org/message-id/52A970BB.8030904@tada.se
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] doubtful PL/Java's activity
In-Reply-To: <52A970BB.8030904@tada.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox