Re: PB error when the browser is stoped

2003-11-08 Thread Thomas Mahler
Hi Sylvain,

[EMAIL PROTECTED] wrote:
snip
The servlet engine uses parallel WorkerThreads to handle all incoming
requests.
So you have to make sure that parallel servlet threads don't 
access the
broker variable without proper synchronization.


How could I be sure?
I answered this in my original reply: always allocate new broker 
instances and release them back to the pool after use.

How do you mean about proper synchronization?
I meant using Java synchronization to lock access to the broker instance.


Do you say that all threads use the same class instance?
If you mean Class object then yes,
If you mean instance of a class then no.


I don't understand what you mean? What's the difference between a Class object and an instance of a Class?
java.lang.Object.class is an object of type java.lang.Class

new Object() is an instance of the class java.lang.Object().




If I declare each time a new PB instance, is this solution 
thread safe?
You have to make sure that each thread (also servlet engine 
threads) always
work with their only broker instance and not with a shared instance.
The most simple way to achieve this is to use a new PB 
instance in each
call.


OK. You declare eache time a new PB instance like:
PersistenceBroker pb = PersistenceBrokerFactory
exactly!

cheers,
Thomas
Thanks
Sylvain

Of course it's important to close the PB imediately after the 
unit of work
is completed

cheers,
Thomas

Thanks
Sylvain

  broker = 
PersistenceBrokerFactory.defaultPersistenceBroker();

recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods

  broker.beginTransaction();
  Iterator iter = broker.getIteratorByQuery(query);

  while (iter.hasNext()) {
Person person = (Person) iter.next();
appResps.put(person.getPersonId(), 
person.getPersonName());

  } 
  
  broker.commitTransaction();
} catch (PersistenceBrokerException t) {
broker.abortTransaction();
t.printStackTrace();
} finally {
broker.close();
}

hmm, I'm not familiar with webserver internals, but think if
you press 'stop' on the browser your method will be pass
through anyway.
StackTrace of the exception on refresh?
Caused by 'broker.abortTransaction()'?
If yes, I think it's a thread problem.


How could I test it?

If the exception really caused by
broker.abort in searchPerson(String lastName),
don't use the class field broker in your search method
recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods
and repeat your test.

regards,
Armin

Regards
Sylvain


regards,
Armin


}
**code**



-Message d'origine-
De: Armin Waibel [mailto:[EMAIL PROTECTED]
Date: mercredi, 5. novembre 2003 10:22
À: OJB Users List
Objet: Re: PB error when the browser is stoped
Hi Sylvain,

[EMAIL PROTECTED] wrote:



Hello,

I'using PB intances to retrieve info from my database.
When the time to search information is too long you can 
press the stop button on the browser.



But when I restart my application there is a 
TransactionNotInProgress exception.



Maybe the PB instance isn't closed when I stop the 
transaction!??

How could I close the PB intansce when I stop the browser?
How could I manage this?
Is someone has an experience?
Can you describe more detailed, some pseudo code?
Which version do you use?
regards,
Armin



Thanks
Sylvain


-


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





-


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





-

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





-

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




-

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






-

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



-

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


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



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



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

PB error when the browser is stoped

2003-11-05 Thread Sylvain.Thevoz
Hello,

I'using PB intances to retrieve info from my database.
When the time to search information is too long you can press the stop button on the 
browser.

But when I restart my application there is a TransactionNotInProgress exception.

Maybe the PB instance isn't closed when I stop the transaction!??
How could I close the PB intansce when I stop the browser?
How could I manage this?
Is someone has an experience?

Thanks
Sylvain

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



Re: PB error when the browser is stoped

2003-11-05 Thread Armin Waibel
Hi Sylvain,

[EMAIL PROTECTED] wrote:
Hello,

I'using PB intances to retrieve info from my database.
When the time to search information is too long you can press the stop button on the 
browser.
But when I restart my application there is a TransactionNotInProgress exception.

Maybe the PB instance isn't closed when I stop the transaction!??
How could I close the PB intansce when I stop the browser?
How could I manage this?
Is someone has an experience?
Can you describe more detailed, some pseudo code?
Which version do you use?
regards,
Armin
Thanks
Sylvain
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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


Re: PB error when the browser is stoped

2003-11-05 Thread Armin Waibel
Hi,

[EMAIL PROTECTED] wrote:

Hello Armin,

I'm using OJB 0.9.5.

uuh! a real oldtimer ;-)

The code is below.

The stop button is pressed during the execution time of this method below.
I think that there something wrong because after I press stop and refresh the page, 
a TransactionNotInProgressException occured.
Have you an idea?
Thanks
Sylvain
**code**
public void searchPerson(String lastName) {
  Criteria crit = new Criteria();
  crit.addLike(lastName, % + lastName + %);
  Query query = new QueryByCriteria(Person.class, crit);
  
  try {
broker is a field in your class?
here you get a new instance, what about the
previous referenced PB instance? Do multiple
threads access class instance?
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods
broker.beginTransaction();
Iterator iter = broker.getIteratorByQuery(query);

while (iter.hasNext()) {
  Person person = (Person) iter.next();
  appResps.put(person.getPersonId(), person.getPersonName());
} 

broker.commitTransaction();
  } catch (PersistenceBrokerException t) {
  broker.abortTransaction();
  t.printStackTrace();
  } finally {
  broker.close();
  }

hmm, I'm not familiar with webserver internals, but think if
you press 'stop' on the browser your method will be pass
through anyway.
StackTrace of the exception on refresh?
Caused by 'broker.abortTransaction()'?
If yes, I think it's a thread problem.
regards,
Armin
}
**code**

-Message d'origine-
De: Armin Waibel [mailto:[EMAIL PROTECTED]
Date: mercredi, 5. novembre 2003 10:22
À: OJB Users List
Objet: Re: PB error when the browser is stoped
Hi Sylvain,

[EMAIL PROTECTED] wrote:

Hello,

I'using PB intances to retrieve info from my database.
When the time to search information is too long you can 
press the stop button on the browser.

But when I restart my application there is a 
TransactionNotInProgress exception.

Maybe the PB instance isn't closed when I stop the transaction!??
How could I close the PB intansce when I stop the browser?
How could I manage this?
Is someone has an experience?
Can you describe more detailed, some pseudo code?
Which version do you use?
regards,
Armin

Thanks
Sylvain

-

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




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



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




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


RE: PB error when the browser is stoped

2003-11-05 Thread Sylvain.Thevoz
Hi,

 -Message d'origine-
 De: Armin Waibel [mailto:[EMAIL PROTECTED]
 Date: mercredi, 5. novembre 2003 11:46
 À: OJB Users List
 Objet: Re: PB error when the browser is stoped
 
 
 Hi,
 
 [EMAIL PROTECTED] wrote:
 
  Hello Armin,
  
  I'm using OJB 0.9.5.
  
 uuh! a real oldtimer ;-)
 
  The code is below.
  
  The stop button is pressed during the execution time of 
 this method below.
  I think that there something wrong because after I press 
 stop and refresh the page, a 
 TransactionNotInProgressException occured.
  
  Have you an idea?
  Thanks
  Sylvain
  
  
  **code**
  public void searchPerson(String lastName) {
Criteria crit = new Criteria();
crit.addLike(lastName, % + lastName + %);
Query query = new QueryByCriteria(Person.class, crit);

try {
 broker is a field in your class?

Yes it is.

 here you get a new instance, what about the
 previous referenced PB instance? Do multiple
 threads access class instance?

What do you mean?
Do you mean that if I declare only one class field (broker) I could have threads 
problems?

  broker = PersistenceBrokerFactory.defaultPersistenceBroker();
 recommened to use
 PersistenceBroker pb = PersistenceBrokerFactory
 in your methods
  broker.beginTransaction();
  Iterator iter = broker.getIteratorByQuery(query);
  
  while (iter.hasNext()) {
Person person = (Person) iter.next();
appResps.put(person.getPersonId(), person.getPersonName());
  } 
  
  broker.commitTransaction();
} catch (PersistenceBrokerException t) {
broker.abortTransaction();
t.printStackTrace();
} finally {
broker.close();
}
  
 hmm, I'm not familiar with webserver internals, but think if
 you press 'stop' on the browser your method will be pass
 through anyway.
 
 StackTrace of the exception on refresh?
 Caused by 'broker.abortTransaction()'?
 If yes, I think it's a thread problem.

How could I test it?


Regards
Sylvain

 
 regards,
 Armin
 
  }
  **code**
  
  
 -Message d'origine-
 De: Armin Waibel [mailto:[EMAIL PROTECTED]
 Date: mercredi, 5. novembre 2003 10:22
 À: OJB Users List
 Objet: Re: PB error when the browser is stoped
 
 
 Hi Sylvain,
 
 [EMAIL PROTECTED] wrote:
 
 Hello,
 
 I'using PB intances to retrieve info from my database.
 When the time to search information is too long you can 
 
 press the stop button on the browser.
 
 But when I restart my application there is a 
 
 TransactionNotInProgress exception.
 
 Maybe the PB instance isn't closed when I stop the transaction!??
 How could I close the PB intansce when I stop the browser?
 How could I manage this?
 Is someone has an experience?
 
 
 Can you describe more detailed, some pseudo code?
 Which version do you use?
 
 regards,
 Armin
 
 
 Thanks
 Sylvain
 
 
 
 
 -
 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



Re: PB error when the browser is stoped

2003-11-05 Thread Armin Waibel
Hi again,

[EMAIL PROTECTED] wrote:

...

here you get a new instance, what about the
previous referenced PB instance? Do multiple
threads access class instance?


What do you mean?
Do you mean that if I declare only one class field (broker) I
could have threads problems?
Exactly! If different threads share/use the same class instance.

   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods
   broker.beginTransaction();
   Iterator iter = broker.getIteratorByQuery(query);

   while (iter.hasNext()) {
 Person person = (Person) iter.next();
 appResps.put(person.getPersonId(), person.getPersonName());
   } 
   
   broker.commitTransaction();
 } catch (PersistenceBrokerException t) {
 broker.abortTransaction();
 t.printStackTrace();
 } finally {
 broker.close();
 }

hmm, I'm not familiar with webserver internals, but think if
you press 'stop' on the browser your method will be pass
through anyway.
StackTrace of the exception on refresh?
Caused by 'broker.abortTransaction()'?
If yes, I think it's a thread problem.


How could I test it?

If the exception really caused by
broker.abort in searchPerson(String lastName),
don't use the class field broker in your search method
recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods
and repeat your test.

regards,
Armin
Regards
Sylvain

regards,
Armin

}
**code**


-Message d'origine-
De: Armin Waibel [mailto:[EMAIL PROTECTED]
Date: mercredi, 5. novembre 2003 10:22
À: OJB Users List
Objet: Re: PB error when the browser is stoped
Hi Sylvain,

[EMAIL PROTECTED] wrote:


Hello,

I'using PB intances to retrieve info from my database.
When the time to search information is too long you can 
press the stop button on the browser.


But when I restart my application there is a 
TransactionNotInProgress exception.


Maybe the PB instance isn't closed when I stop the transaction!??
How could I close the PB intansce when I stop the browser?
How could I manage this?
Is someone has an experience?
Can you describe more detailed, some pseudo code?
Which version do you use?
regards,
Armin


Thanks
Sylvain


-

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





-

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




-

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




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



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




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


RE: PB error when the browser is stoped

2003-11-05 Thread Sylvain.Thevoz
Hi again Armin

 -Message d'origine-
 De: Armin Waibel [mailto:[EMAIL PROTECTED]
 Date: mercredi, 5. novembre 2003 12:22
 À: OJB Users List
 Objet: Re: PB error when the browser is stoped
 
 
 Hi again,
 
 [EMAIL PROTECTED] wrote:
 
 ...
  
 here you get a new instance, what about the
 previous referenced PB instance? Do multiple
 threads access class instance?
  
  
  What do you mean?
  Do you mean that if I declare only one class field (broker) I
  could have threads problems?
  
 Exactly! If different threads share/use the same class instance.


Just some question to be sure to understand:

How could you define a thread in this case?
Do you say that all threads use the same class instance?

If I declare each time a new PB instance, is this solution thread safe?


Thanks
Sylvain

  
 broker = PersistenceBrokerFactory.defaultPersistenceBroker();
 
 recommened to use
 PersistenceBroker pb = PersistenceBrokerFactory
 in your methods
 
 broker.beginTransaction();
 Iterator iter = broker.getIteratorByQuery(query);

 while (iter.hasNext()) {
   Person person = (Person) iter.next();
   appResps.put(person.getPersonId(), person.getPersonName());
 } 
 
 broker.commitTransaction();
   } catch (PersistenceBrokerException t) {
   broker.abortTransaction();
   t.printStackTrace();
   } finally {
   broker.close();
   }
 
 
 hmm, I'm not familiar with webserver internals, but think if
 you press 'stop' on the browser your method will be pass
 through anyway.
 
 StackTrace of the exception on refresh?
 Caused by 'broker.abortTransaction()'?
 If yes, I think it's a thread problem.
  
  
  How could I test it?
  
 If the exception really caused by
 broker.abort in searchPerson(String lastName),
 don't use the class field broker in your search method
 
  recommened to use
  PersistenceBroker pb = PersistenceBrokerFactory
  in your methods
 
 and repeat your test.
 
 regards,
 Armin
 
  
  Regards
  Sylvain
  
  
 regards,
 Armin
 
 
 }
 **code**
 
 
 
 -Message d'origine-
 De: Armin Waibel [mailto:[EMAIL PROTECTED]
 Date: mercredi, 5. novembre 2003 10:22
 À: OJB Users List
 Objet: Re: PB error when the browser is stoped
 
 
 Hi Sylvain,
 
 [EMAIL PROTECTED] wrote:
 
 
 Hello,
 
 I'using PB intances to retrieve info from my database.
 When the time to search information is too long you can 
 
 press the stop button on the browser.
 
 
 But when I restart my application there is a 
 
 TransactionNotInProgress exception.
 
 
 Maybe the PB instance isn't closed when I stop the transaction!??
 How could I close the PB intansce when I stop the browser?
 How could I manage this?
 Is someone has an experience?
 
 
 Can you describe more detailed, some pseudo code?
 Which version do you use?
 
 regards,
 Armin
 
 
 
 Thanks
 Sylvain
 
 
 
 
 
 -
 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 
 
 -
 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 -
 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



RE: PB error when the browser is stoped

2003-11-05 Thread Mahler Thomas
Hi Sylvain,

snip
 
 Just some question to be sure to understand:
 
 How could you define a thread in this case?

The servlet engine uses parallel WorkerThreads to handle all incoming
requests.
So you have to make sure that parallel servlet threads don't access the
broker variable without proper synchronization.

 Do you say that all threads use the same class instance?

If you mean Class object then yes,
If you mean instance of a class then no.

 
 If I declare each time a new PB instance, is this solution 
 thread safe?

You have to make sure that each thread (also servlet engine threads) always
work with their only broker instance and not with a shared instance.
The most simple way to achieve this is to use a new PB instance in each
call.
Of course it's important to close the PB imediately after the unit of work
is completed

cheers,
Thomas

 
 Thanks
 Sylvain
 
   
  broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  
  recommened to use
  PersistenceBroker pb = PersistenceBrokerFactory
  in your methods
  
  broker.beginTransaction();
  Iterator iter = broker.getIteratorByQuery(query);
   
  while (iter.hasNext()) {
Person person = (Person) iter.next();
appResps.put(person.getPersonId(), person.getPersonName());
  } 
  
  broker.commitTransaction();
} catch (PersistenceBrokerException t) {
broker.abortTransaction();
t.printStackTrace();
} finally {
broker.close();
}
  
  
  hmm, I'm not familiar with webserver internals, but think if
  you press 'stop' on the browser your method will be pass
  through anyway.
  
  StackTrace of the exception on refresh?
  Caused by 'broker.abortTransaction()'?
  If yes, I think it's a thread problem.
   
   
   How could I test it?
   
  If the exception really caused by
  broker.abort in searchPerson(String lastName),
  don't use the class field broker in your search method
  
   recommened to use
   PersistenceBroker pb = PersistenceBrokerFactory
   in your methods
  
  and repeat your test.
  
  regards,
  Armin
  
   
   Regards
   Sylvain
   
   
  regards,
  Armin
  
  
  }
  **code**
  
  
  
  -Message d'origine-
  De: Armin Waibel [mailto:[EMAIL PROTECTED]
  Date: mercredi, 5. novembre 2003 10:22
  À: OJB Users List
  Objet: Re: PB error when the browser is stoped
  
  
  Hi Sylvain,
  
  [EMAIL PROTECTED] wrote:
  
  
  Hello,
  
  I'using PB intances to retrieve info from my database.
  When the time to search information is too long you can 
  
  press the stop button on the browser.
  
  
  But when I restart my application there is a 
  
  TransactionNotInProgress exception.
  
  
  Maybe the PB instance isn't closed when I stop the 
 transaction!??
  How could I close the PB intansce when I stop the browser?
  How could I manage this?
  Is someone has an experience?
  
  
  Can you describe more detailed, some pseudo code?
  Which version do you use?
  
  regards,
  Armin
  
  
  
  Thanks
  Sylvain
  
  
  
  
  
  -
  
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
  
  
  
  
  -
  
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
  
  
  -
  
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
   
   
   
  
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
  
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



RE: PB error when the browser is stoped

2003-11-05 Thread Sylvain.Thevoz
Hi Thomas,


 -Message d'origine-
 De: Mahler Thomas [mailto:[EMAIL PROTECTED]
 Date: mercredi, 5. novembre 2003 14:17
 À: 'OJB Users List'
 Objet: RE: PB error when the browser is stoped
 
 
 Hi Sylvain,
 
 snip
  
  Just some question to be sure to understand:
  
  How could you define a thread in this case?
 
 The servlet engine uses parallel WorkerThreads to handle all incoming
 requests.
 So you have to make sure that parallel servlet threads don't 
 access the
 broker variable without proper synchronization.

How could I be sure?
How do you mean about proper synchronization?

 
  Do you say that all threads use the same class instance?
 
 If you mean Class object then yes,
 If you mean instance of a class then no.

I don't understand what you mean? What's the difference between a Class object and an 
instance of a Class?

 
  
  If I declare each time a new PB instance, is this solution 
  thread safe?
 
 You have to make sure that each thread (also servlet engine 
 threads) always
 work with their only broker instance and not with a shared instance.
 The most simple way to achieve this is to use a new PB 
 instance in each
 call.

OK. You declare eache time a new PB instance like:
PersistenceBroker pb = PersistenceBrokerFactory


Thanks
Sylvain

 Of course it's important to close the PB imediately after the 
 unit of work
 is completed
 
 cheers,
 Thomas
 
  
  Thanks
  Sylvain
  

   broker = 
 PersistenceBrokerFactory.defaultPersistenceBroker();
   
   recommened to use
   PersistenceBroker pb = PersistenceBrokerFactory
   in your methods
   
   broker.beginTransaction();
   Iterator iter = broker.getIteratorByQuery(query);
  
   while (iter.hasNext()) {
 Person person = (Person) iter.next();
 appResps.put(person.getPersonId(), 
 person.getPersonName());
   } 
   
   broker.commitTransaction();
 } catch (PersistenceBrokerException t) {
 broker.abortTransaction();
 t.printStackTrace();
 } finally {
 broker.close();
 }
   
   
   hmm, I'm not familiar with webserver internals, but think if
   you press 'stop' on the browser your method will be pass
   through anyway.
   
   StackTrace of the exception on refresh?
   Caused by 'broker.abortTransaction()'?
   If yes, I think it's a thread problem.


How could I test it?

   If the exception really caused by
   broker.abort in searchPerson(String lastName),
   don't use the class field broker in your search method
   
recommened to use
PersistenceBroker pb = PersistenceBrokerFactory
in your methods
   
   and repeat your test.
   
   regards,
   Armin
   

Regards
Sylvain


   regards,
   Armin
   
   
   }
   **code**
   
   
   
   -Message d'origine-
   De: Armin Waibel [mailto:[EMAIL PROTECTED]
   Date: mercredi, 5. novembre 2003 10:22
   À: OJB Users List
   Objet: Re: PB error when the browser is stoped
   
   
   Hi Sylvain,
   
   [EMAIL PROTECTED] wrote:
   
   
   Hello,
   
   I'using PB intances to retrieve info from my database.
   When the time to search information is too long you can 
   
   press the stop button on the browser.
   
   
   But when I restart my application there is a 
   
   TransactionNotInProgress exception.
   
   
   Maybe the PB instance isn't closed when I stop the 
  transaction!??
   How could I close the PB intansce when I stop the browser?
   How could I manage this?
   Is someone has an experience?
   
   
   Can you describe more detailed, some pseudo code?
   Which version do you use?
   
   regards,
   Armin
   
   
   
   Thanks
   Sylvain
   
   
   
   
   
   -
   
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   
   
   
   
   
   -
   
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   
   
   
   -
   
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   
   
   
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   



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



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