Hi Stefan,

think this is the best way to handle the PB-api.
OJB pools the PB-instances and (if configured)
the db-connections in separate pools, so the costs to get a
PB/connection-instance are low.

An alternative way is to bound a PB instance
to the thread lifecycle. Get PB when thread is created,
close PB when thread died. But this solution has some pitfalls.
So, your way seems for me the best.

regards,
Armin

----- Original Message -----
From: "Stefan Schlösser" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, January 21, 2002 2:40 PM
Subject: Correct Multi-threaded usage of Broker - Guidelines ?


Hi,

we are using the OJB-layer in a Client/Server app. Each client is
represented by a
thread on the server. Each client wishes to write to the database.

Currently I'have designed it in the following way:

Each thread gets an Instance of a class which uses the broker. In each
method of
the class is implemted in the following way:

PersistenceBrokerFactory.createPersistenceBroker(pbkey);

// do some db stuff

broker.close();

Will such a design make use of connection pooling and is this a resource
saving way
to use the broker?

Please give me some advice on whether this is a good design or how it
could be
improved.

Thanks for your Help,

Yours,
  Stefan Schlösser

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to