Barry Lind wrote:
> Does the mechanism you are planning support running any JVM? In my
> opionion Kaffe isn't good enough to be widely useful. I think you
> should be able to plugin whatever jvm is best on your platform, which
> will likely be either the Sun or IBM JVMs.
Ok, I also had problems with caffe, but it may work. I like it becouse
it is small (the source is about 6M). As much as I know Java VM`s has a
somewhat standard native interface called JNI. I use this to start the
VM, and communicate with it. If you think I should change I will do it,
but it may take a long time to get the new VM. For then I have to run kaffe.
> Also, can you explain this a little bit more. How does the jvm
> process get started? (I would hope that the postgresql server
> processes would start it when needed, as opposed to requiring that it
> be started separately.) How does the jvm access these shared memory
> structures? Since there aren't any methods in the java API to do such
> things that I am aware of.
JVM does not. 'the java process' does with simple posix calls. I use
debian potatoe, on any other posix system it should work, on any other
somewhat posix compatible system it may work, I am not sure...
> I don't understand how you do this in java? I must not be
> understanding something correctly here.
The 'java request_handler' is not a java function, it is the C
call_handler in the Postgres side, that is started when a function of
language 'pljava' is called.
I made some failure in my previous mail. At home I named the pl/java
language pl/pizza (something that is not caffe, but well known enough
:). The application has two running binaries:
-pizza (which was called 'java process' last time) This is a small C
program that uses JNI to start VM and call java methods.
-plpizza.so the shared object that contains the call_handler function.
>> -when java thread receives the signal, it reads the message(s) from
>> the queue, and starts some actions. When done it tells postgres with
>> a signal that it is ready, and it can come for its results. This will
>> be rewritten see below problems.
> Are signals the best way to accomplish this?
I don`t know if it is the best, it is the only way I know :)
Do you know any other ways?
>> -And postgres is runing, while java is waiting for postgres to say
> But in reality if the postgres process is executing a stored function
> it needs to wait for the result of that function call before
> continuing doesn't it?
Surely, this is done. How could Postgres tell the result anyway ? :)
>> Threading on the java process side is not done yet, ok, it is not
>> that hard, I will write it, if it will be realy neccessary.
> Agreed, this is important.
> Shouldn't this code use all or most of the logic found in the FE/BE
> protocol? Why invent and code another mechanism to transfer data when
> one already exists. (I will admit that the current FE/BE mechanism
> isn't the ideal choice, but it seems easier to reuse what exists for
> now and improve on it later).
Well, I am relatively new to Postgres, and I don`t know these protocols.
In the weekend I will start to learn it, and in Sunday or Monday I maybe
I will understand it, if not, next weekend..
> You didn't mention how you plan to deal with the transaction
> symantics. So what happens when the pl/java function calls through
> jdbc back to the server to insert some data? That should happen in
> the same transaction as the caller correct?
I don`t think this will be a problem, I have ideas for this. Idea mean:
I know how I will start it, it may be good, or it may be fataly stupid
idea, it will turn out when I tried it. Simply: The same way plpizza
tells pizza the request, pizza can talk back to plpizza. This is planed
to work with similar mechanism I described last time (shm+signals).
Monday I will try to send a little pieces of code to make thing clear, ok?
In response to
pgsql-hackers by date
|Next:||From: Karel Zak||Date: 2001-12-05 09:20:12|
|Subject: Re: date formatting and tab-complete patch|
|Previous:||From: Tatsuo Ishii||Date: 2001-12-05 08:41:04|
|Subject: Intermediate report for AIX 5L port|
pgsql-jdbc by date
|Next:||From: Barry Lind||Date: 2001-12-05 17:32:19|
|Subject: Re: [GENERAL] java stored procedures|
|Previous:||From: Barry Lind||Date: 2001-12-05 01:34:21|
|Subject: Re: java stored procedures|
pgsql-general by date
|Next:||From: Rich Ryan||Date: 2001-12-05 09:24:14|
|Subject: ERROR: MemoryContextAlloc: invalid request size |
|Previous:||From: Peter Peltonen||Date: 2001-12-05 08:20:05|
|Subject: Re: postgres idle process and other problems|