agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] PL/Java functions and JDBC
5+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] PL/Java functions and JDBC
@ 2006-02-22 17:46 
  2006-02-22 17:51 ` [Pljava-dev] PL/Java functions and JDBC 
  0 siblings, 1 reply; 5+ messages in thread

From:  @ 2006-02-22 17:46 UTC (permalink / raw)

Hi,

I hope that mail does not appear two times in the list ...

After testing PL/Java and multithreading, I try something different. My scenario:

- A PL/Java trigger is called before an update is exceuted on a table. This trigger writes something into a queue (singelton pattern)

- A PL/Java function is called from an external application using JDBC. This function should read data from the queue and do something with it

No Problems with:

- Write and read data from the queue

- Call the PL/Java function from the pgAdmin III query tool 

Problems:

- If the PL/Java function is called using JDBC (statement.execute("select functionName();")), the queue is always empty (???)


Any ideas what to do?

thx la lot,

Patrick

______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* [Pljava-dev] PL/Java functions and JDBC
  2006-02-22 17:46 [Pljava-dev] PL/Java functions and JDBC 
@ 2006-02-22 17:51 ` 
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2006-02-22 17:51 UTC (permalink / raw)

Patrick,
I'm not sure this is your problem, but each connection uses it's own 
JVM. So if you use one connection to populate an in-memory queue, 
there's no way you can read that queue from another connection. The only 
way to accomplish that is to use a persistent queue.

Regards,
Thomas Hallgren

Patrick Peisker wrote:
> Hi,
>
> I hope that mail does not appear two times in the list ...
>
> After testing PL/Java and multithreading, I try something different. My scenario:
>
> - A PL/Java trigger is called before an update is exceuted on a table. This trigger writes something into a queue (singelton pattern)
>
> - A PL/Java function is called from an external application using JDBC. This function should read data from the queue and do something with it
>
> No Problems with:
>
> - Write and read data from the queue
>
> - Call the PL/Java function from the pgAdmin III query tool 
>
> Problems:
>
> - If the PL/Java function is called using JDBC (statement.execute("select functionName();")), the queue is always empty (???)
>
>
> Any ideas what to do?
>
> thx la lot,
>
> Patrick
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>   





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* [Pljava-dev] PL/Java functions and JDBC
@ 2006-02-24 18:13 
  2006-02-24 20:40 ` [Pljava-dev] PL/Java functions and JDBC 
  0 siblings, 1 reply; 5+ messages in thread

From:  @ 2006-02-24 18:13 UTC (permalink / raw)

Thomas/Patrick
May I jump in with a question on that point? If each connection uses its
own JVM then
1) Have you any idea what the approximate memory overhead is?
2) How do we force the JVM to unload when a new JAR is released? I am
having fun with that at the moment - I am dropping the connection
entirely which is a bit cumbersome. This is going to give me a problem
when I go live shortly.

Tim Clarke

> -----Original Message-----
> From: pljava-dev-bounces at gborg.postgresql.org 
> [mailto:pljava-dev-bounces at gborg.postgresql.org] On Behalf Of 
> Thomas Hallgren
> Sent: 22 February 2006 17:52
> To: Patrick Peisker
> Cc: pljava-dev at gborg.postgresql.org
> Subject: Re: [Pljava-dev] PL/Java functions and JDBC
> 
> 
> Patrick,
> I'm not sure this is your problem, but each connection uses it's own 
> JVM. So if you use one connection to populate an in-memory queue, 
> there's no way you can read that queue from another 
> connection. The only 
> way to accomplish that is to use a persistent queue.
> 
> Regards,
> Thomas Hallgren
> 
> Patrick Peisker wrote:
> > Hi,
> >
> > I hope that mail does not appear two times in the list ...
> >
> > After testing PL/Java and multithreading, I try something 
> different. My scenario:
> >
> > - A PL/Java trigger is called before an update is exceuted 
> on a table. This trigger writes something into a queue 
> (singelton pattern)
> >
> > - A PL/Java function is called from an external application 
> using JDBC. This function should read data from the queue and 
> do something with it
> >
> > No Problems with:
> >
> > - Write and read data from the queue
> >
> > - Call the PL/Java function from the pgAdmin III query tool 
> >
> > Problems:
> >
> > - If the PL/Java function is called using JDBC 
> (statement.execute("select functionName();")), the queue is 
> always empty (???)
> >
> >
> > Any ideas what to do?
> >
> > thx la lot,
> >
> > Patrick
> >
> > ______________________________________________________________
> > Verschicken Sie romantische, coole und witzige Bilder per SMS!
> > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> >
> > _______________________________________________
> > Pljava-dev mailing list
> > Pljava-dev at gborg.postgresql.org
> > http://gborg.postgresql.org/mailman/listinfo/pljava-dev
> >   
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
> 




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* [Pljava-dev] PL/Java functions and JDBC
  2006-02-24 18:13 [Pljava-dev] PL/Java functions and JDBC 
@ 2006-02-24 20:40 ` 
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2006-02-24 20:40 UTC (permalink / raw)

Tim Clarke wrote:
> Thomas/Patrick
> May I jump in with a question on that point? If each connection uses its
> own JVM then
> 1) Have you any idea what the approximate memory overhead is?
>   
I've measured between 20-40MB virtual memory and 6-13MB real memory per 
session using a standard Sun JVM with no special tuning. It might become 
more of course. It all depends on what you are doing.
> 2) How do we force the JVM to unload when a new JAR is released? I am
> having fun with that at the moment - I am dropping the connection
> entirely which is a bit cumbersome. This is going to give me a problem
> when I go live shortly.
>
>   
There's no way to do that at present. It wouldn't be too hard to write a 
C function that does it though, but I've had problems reloading the JVM 
after that. I'm not sure JNI is designed to handle multiple load/unload 
in a good way, nor am I sure that a JVM unload will free up a 
significant amount of memory.

Are you using a connection pool at present?

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* [Pljava-dev] PL/Java functions and JDBC
@ 2006-02-27 19:30 
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2006-02-27 19:30 UTC (permalink / raw)

> -----Original Message-----
> From: Thomas Hallgren [mailto:thomas at tada.se] 
> Sent: 25 February 2006 13:54
> To: Tim Clarke
> Subject: Re: [Pljava-dev] PL/Java functions and JDBC
> 
> My tests were not very scientific :-). I just measured the overall 
> consumption as I spawned more and more connections. I guess 
> any system 
> monitor tool would do. You can use 'top' for instance.

Hehe - and I thought there was some kind of "the size of my VM object
total is ..." call.

> The recommended way to do it is to drop your connection and 
> create a new 
> one. Without that there can never be a guarantee that the new 
> code will 
> be used. Compare to a normal Java process where you change the 
> classloaders in runtime. There might be several places where static 
> variables, objects on the call stack, etc. holds on to old 
> classes and 
> instances of those classes.

Yeah, that's what I'm doing, just dropping the conn.

> Having said that, PL/Java could make a better effort then what's done 
> today. At present, it will drop the classloaders of all 
> schemas but it 
> will not free up the function to method map. That would 
> definitely be an 
> improvement. It's not trivial to implement though.

OK

> The current CVS now contains code that resets the function to 
> method map 
> when jars are installed, replaced, or removed, and when the 
> classpath is 
> changed. It will be included in the 1.3 release of PL/Java. I don't 
> think that's far away, couple of weeks tops.

That's call - thanks and kudos to the team for their work and that.

> 
> Regards,
> Thomas Hallgren




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2006-02-27 19:30 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-22 17:46 [Pljava-dev] PL/Java functions and JDBC 
2006-02-22 17:51 ` 
2006-02-24 18:13 [Pljava-dev] PL/Java functions and JDBC 
2006-02-24 20:40 ` 
2006-02-27 19:30 [Pljava-dev] PL/Java functions and JDBC 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox