agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Is it safe to use multi-threaded PL/Java in single-threaded postgres process?
Date: Sun, 16 Mar 2014 13:05:30 +0900
Message-ID: <0AF1495BB9BA466CAB0D57C2DCAB44DB@maumau> (raw)
In-Reply-To: <94B1FE06-4C37-488D-84C3-E4E4B0C94D24@me.com>
References: <30A6B4B499494CED93770BBC4835840C@maumau>
<A832684586A84610AD7173AB42138F38@maumau>
<94B1FE06-4C37-488D-84C3-E4E4B0C94D24@me.com>
From: "Hal Hildebrand" <hal.hildebrand at me.com>
> So, I really think this question has been definitively answered.
Yes, I found a similar mail thread:
http://postgresql.1045698.n5.nabble.com/doubtful-PL-Java-s-activity-td5783047.html
But I understood that the person who raised the question did not show a test
case, nor the PL/Java community did not answer why PL/Java has no problem in
mixing multi-threaded code and single-threaded code.
> If you can produce a test case of your concerns which demonstrates the
> issue, we can discuss it.
I'd like to do so if I could do it, but I cannot. This is why I'm asking
this question. I want to believe PL/Java has no problem and want to use it.
I proposed using PL/Java to my colleagues. However, they are concerned
about this question. I want to convince them by showing how PL/Java is safe
in terms of theory.
> But the simple answer to your question is simply: yes.
> Pl/java obeys the rules and works according to spec.
> It does the right thing in the right way using the best practices.
Could you elaborate on this? The details should be the answer I'm looking
for.
As I said as below, it doesn't seem that PL/Java obeys the JNI spec, because
pljava.so is not compiled with -mt, -D_REENTRANT nor -D_POSIX_C_SOURCE. In
short, I'd like to know why it is safe to make JVM to load single-threaded
pljava.so.
>> FYI, JNI specification says that the code called from Java VM should be
>> built for multi-threading as follows. But postgres is not.
>>
>> http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp9502
>>
>> [Excerpt]
>> Compiling, Loading and Linking Native Methods
>> Since the Java VM is multithreaded, native libraries should also be
>> compiled and linked with multithread aware native compilers. For example,
>> the -mt flag should be used for C++ code compiled with the Sun Studio
>> compiler. For code complied with the GNU gcc compiler, the
>> flags -D_REENTRANT or -D_POSIX_C_SOURCE should be used. For more
>> information please refer to the native compiler documentation.
Regards
MauMau
view thread (13+ messages) latest in thread
Message-ID: <0AF1495BB9BA466CAB0D57C2DCAB44DB@maumau>
Permalink: ../0AF1495BB9BA466CAB0D57C2DCAB44DB@maumau/
Also on: postgresql.org/message-id/0AF1495BB9BA466CAB0D57C2DCAB44DB@maumau
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] Is it safe to use multi-threaded PL/Java in single-threaded postgres process?
In-Reply-To: <0AF1495BB9BA466CAB0D57C2DCAB44DB@maumau>
* 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