Skip site navigation (1) Skip section navigation (2)

Re: [ADMIN] Extra Postgres Processes

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "PAUL J THOMPSON" <thomppj(at)okstate(dot)edu>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [ADMIN] Extra Postgres Processes
Date: 1999-07-13 16:01:05
Message-ID: l03130303b3b111a414dc@[] (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
I am redirecting this to the INTERFACES list, where it belongs, as it has
nothing to do with Postgres administration.

At 18:44 +0300 on 13/07/1999, PAUL J THOMPSON wrote:

> Ok. I have a class called QuizData which maintains all database
> connections. An instance of this class is created by a servlet each time
> it runs the doGet() method. In the finalize method of the QuizData
> class, I have something like:
> 	if (isOpen()) {
> 		db.close;
> 	}
> isOpen() returns the value of a instance variable of type boolean in the
> object (QuizData) when the database is successfully opened.
> How does that sound? Anything else needed so far?

Er, finalize method? It is called only when the object is about to be
garbage collected. That is, only when the VM is short in memory. This is
definitely not the way to go (I have a feeling you learned Java after
learning C++. Finalize is rarely used in practice that I know).

No, there are two ways to go about this. Either have a close() method in
the QuizData which calls the above sentence, and remember to call this when
you finish working with the QuizData, or have a timer thread that sets
turns off the connection X minutes after its last usage. This should
require a bit of design, though.


Herouth Maoz, Internet developer.
Open University of Israel - Telem project

pgsql-interfaces by date

Next:From: Matthew HagertyDate: 1999-07-13 16:02:18
Subject: Re: [INTERFACES] 8K query limit in 6.5?
Previous:From: Tom LaneDate: 1999-07-13 15:55:29
Subject: Re: [INTERFACES] Three posts and no response 8--(

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group