Hi Armin,
I have an object with an init method where I assign a PersistenceBroker
instance using

PersistenceBrokerFactory.defaultPersistenceBroker()

This object then has an onEvent() method that is called and uses
broker.store().

I tried modifying the object so that the broker is obtained in the onEvent
instead of the init and I started getting
"Borrow broker from pool failed" Exceptions. I have my connection-pool set
up as follows:

<connection-pool maxActive="-1" whenExhaustedAction="2"
validationQuery="select 1 from t_client"/>

Do you have any suggestions for what I might be doing wrong?

Mike

----- Original Message ----- 
From: "Armin Waibel" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 08, 2003 6:02 PM
Subject: Re: ConcurrentModificationException


> Hi Michael,
>
> On Wed, 8 Oct 2003 17:31:15 +0100, Michael Watson
> <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> >
> > I'm finding I quite reguarly get this exception when I'm attempting to
> > call
> > PersistenceBroker.store(Object) from multiple threads simultaneously.
> >
> Do several threads share the same PB instance?
> If so, this is not allowed. PB instances are not
> threadsafe itself, but they are pooled so it's no
> performance impact to use a separate PB instance for each thread.
>
> regards,
> Armin
>
> > <?xml version='1.0'?>
> > <exception>
> > <cause>
> > <detailMessage/>
> >
<exceptionClass>java.util.ConcurrentModificationException</exceptionClass>
> > <stackTrace>
> >
<stackTrace>java.util.AbstractList$Itr.checkForComodification(AbstractList.j
> > ava:444)</stackTrace>
> >
<stackTrace>java.util.AbstractList$Itr.next(AbstractList.java:417)</stackTra
> > ce>
> >
<stackTrace>java.util.AbstractCollection.remove(AbstractCollection.java:250)
> > </stackTrace>
> >
<stackTrace>org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)</stackTrace>
> >
<stackTrace>org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)</stackTrace>
> >
<stackTrace>org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unk
> > nown Source)</stackTrace>
> > ...
> > </stackTrace>
> > </cause>
> > <detailMessage>Failed to update History record
> > java.util.ConcurrentModificationException</detailMessage>
> >
<exceptionClass>org.apache.ojb.broker.PersistenceBrokerException</exceptionC
> > lass>
> > <stackTrace/>
> > </exception>
> >
> > Obviously somewhere in the broker there's been an attempt to modify the
> > structure of a list by 2 or more threads simultaneously.
> >
> > My question is, has anything been done to prevent this in a newer
> > version or
> > should I just catch these exceptions and retry the store?
> >
> > I'm using ojb-1.0.rc3 at the moment.
> >
> > Regards,
> >
> > Mike
> >
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to