[Pljava-dev] Again multithreading

Thomas Hallgren thomas at tada.se
Thu Feb 23 07:58:46 UTC 2006


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




More information about the Pljava-dev mailing list