[Pljava-dev] doubtful PL/Java's activity

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] doubtful PL/Java's activity
Date: 2013-12-12 08:15:55
Message-ID: 52A970BB.8030904@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Christian Hammers 2013-12-12 09:37:19 [Pljava-dev] doubtful PL/Java's activity
Previous Message Taniguchi, Yasunori 2013-12-09 11:16:01 [Pljava-dev] doubtful PL/Java's activity