Re: ConcurrentModificationException

2003-10-09 Thread Michael Watson
Thanks, that's exactly the approach I'd taken and it works fine.

- Original Message - 
From: "Justis Peters" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Thursday, October 09, 2003 4:22 PM
Subject: Re: ConcurrentModificationException


> To be really careful about closing the broker, you may want to include a
try/finally structure.  Here is Charles' code modified:
>
> public void onEvent() {
> PersistenceBroker pb =
PersistenceBrokerFactory.defaultPersistenceBroker();
> try {
> pb.store(this); // or whatever it is you want to do with the
broker
> } finally {
> pb.close();
> }
> }
>
> Charles Anthony [EMAIL PROTECTED] wrote:
> > Hi,
> >
> > You need to ensure that you are closing the broker.
> >
> > public void  onEvent(){
> >   PersistenceBroker pb =
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> >   pb.store(this); // or whatever it is you want to do with the broker
> >   pb.close();
> > }
> >
> >
> > You should only get brokers when you need them, and close them when
you've
> > finished with them.
> >
> > HTH,
> >
> > Charles.
> >
> > > -Original Message-
> > > From: Michael Watson [mailto:[EMAIL PROTECTED]
> > > Sent: 09 October 2003 12:53
> > > To: OJB Users List; [EMAIL PROTECTED]
> > > Subject: Re: ConcurrentModificationException
> > >
> > >
> > > 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:
> > >
> > >  > > 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
> > > >
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > >
> > > java.util.ConcurrentModificationException > > eptionClass>
> > > > > 
> > > > >
> > > java.util.AbstractList$Itr.checkForComodification(
> > > AbstractList.j
> > > > > ava:444)
> > > > >
> > > java.util.AbstractList$Itr.next(AbstractList.java:
> > > 417) > > > > ce>
> > > > >
> > > java.util.AbstractCollection.remove(AbstractCollec
> > > tion.java:250)
> > > > > 
> > > > >
> > > org.apache.ojb.broker.core.PersistenceBrokerImpl.s
> > > tore(Unknown
> > > > > Source)
> > > > >
> > > org.apache.ojb.broker.core.PersistenceBrokerImpl.s
> > > tore(Unknown
> > > > > Source)
> > > > >
> > > org.apache.ojb.broker.core.DelegatingPersistenceBr
> > > oker.store(Unk
> > > > > nown Source)
> > > > > ...
> > > >

Re: ConcurrentModificationException

2003-10-09 Thread Michael Watson
Oops.
Thanks Charles.

- Original Message - 
From: "Charles Anthony" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Thursday, October 09, 2003 12:52 PM
Subject: RE: ConcurrentModificationException


> Hi,
>
> You need to ensure that you are closing the broker.
>
> public void  onEvent(){
>   PersistenceBroker pb =
> PersistenceBrokerFactory.defaultPersistenceBroker();
>   pb.store(this); // or whatever it is you want to do with the broker
>   pb.close();
> }
>
>
> You should only get brokers when you need them, and close them when you've
> finished with them.
>
> HTH,
>
> Charles.
>
> > -Original Message-
> > From: Michael Watson [mailto:[EMAIL PROTECTED]
> > Sent: 09 October 2003 12:53
> > To: OJB Users List; [EMAIL PROTECTED]
> > Subject: Re: ConcurrentModificationException
> >
> >
> > 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:
> >
> >  > 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
> > >
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > java.util.ConcurrentModificationException > eptionClass>
> > > > 
> > > >
> > java.util.AbstractList$Itr.checkForComodification(
> > AbstractList.j
> > > > ava:444)
> > > >
> > java.util.AbstractList$Itr.next(AbstractList.java:
> > 417) > > > ce>
> > > >
> > java.util.AbstractCollection.remove(AbstractCollec
> > tion.java:250)
> > > > 
> > > >
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.s
> > tore(Unknown
> > > > Source)
> > > >
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.s
> > tore(Unknown
> > > > Source)
> > > >
> > org.apache.ojb.broker.core.DelegatingPersistenceBr
> > oker.store(Unk
> > > > nown Source)
> > > > ...
> > > > 
> > > > 
> > > > Failed to update History record
> > > > java.util.ConcurrentModificationException
> > > >
> > org.apache.ojb.broker.PersistenceBrokerExcepti
> > on > > > lass>
> > > > 
> > > > 
> > > >
> > > > 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 unsubscri

Re: ConcurrentModificationException

2003-10-09 Thread Michael Watson
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:



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
>
> > 
> > 
> > 
> > 
> >
java.util.ConcurrentModificationException
> > 
> >
java.util.AbstractList$Itr.checkForComodification(AbstractList.j
> > ava:444)
> >
java.util.AbstractList$Itr.next(AbstractList.java:417) > ce>
> >
java.util.AbstractCollection.remove(AbstractCollection.java:250)
> > 
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unk
> > nown Source)
> > ...
> > 
> > 
> > Failed to update History record
> > java.util.ConcurrentModificationException
> >
org.apache.ojb.broker.PersistenceBrokerException > lass>
> > 
> > 
> >
> > 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]



ConcurrentModificationException

2003-10-08 Thread Michael Watson
Hi all,

I'm finding I quite reguarly get this exception when I'm attempting to call
PersistenceBroker.store(Object) from multiple threads simultaneously.





java.util.ConcurrentModificationException

java.util.AbstractList$Itr.checkForComodification(AbstractList.j
ava:444)
java.util.AbstractList$Itr.next(AbstractList.java:417)
java.util.AbstractCollection.remove(AbstractCollection.java:250)

org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
Source)
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
Source)
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unk
nown Source)
...


Failed to update History record
java.util.ConcurrentModificationException
org.apache.ojb.broker.PersistenceBrokerException



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]



Documentation Tool?

2003-09-29 Thread Michael Watson
Are there any tools out there that will parse a repository xml document and
produce some half decent documentation to show the structure and
relationships between objects to be persisted?


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