[Pljava-dev] Again multithreading

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] Again multithreading
Date: 2006-02-23 07:58:46
Message-ID: 43FD6B36.1030104@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Patrick Peisker wrote:
> (1) PL/Java uses one JVM per connection. Run the PL/Java trigger functions in one "main" JVM or run the functions in the JVM of the actuator (e.g. a JDBC connection unsing the SQL-statement 'insert')?
>
>
The trigger will be executed in the JVM that becomes embedded in the
PostgreSQL backend process that represents the connection. PostgreSQL
spawns a new process for each connection that is opened. The JVM becomes
part of that process.
> (2) What happens to a thread if it is created in a JVM of an conncetion and the connection is closed?
>
>
When the connection is closed, the PostgreSQL backend process terminates
and since the JVM is embedded, it terminates too, in a controlled manner.

> (3) Referring to my first mail about multihreading, is there any chance to ensure that a thread is called again from the backend?
>
>
No, not unless you do it yourself. If you issue a function call to a
Java function and let that function sleep for a short period of time,
other threads that are waiting to use the backend will be released.

Kind Regards,
Thomas Hallgren

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Tim Clarke 2006-02-24 18:13:14 [Pljava-dev] PL/Java functions and JDBC
Previous Message Patrick Peisker 2006-02-23 07:32:40 [Pljava-dev] Again multithreading