You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Oliver Strässer <ol...@getunik.com> on 2010/04/28 09:19:08 UTC
TDB ConcurrentModificationException
Hi @ all
After I changed the Actioncenter from sesame to tdb, i got the following Error:
java.util.ConcurrentModificationException
at com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.checkCourrentModification(GraphTDBBase.java:209)
at com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.hasNext(GraphTDBBase.java:217)
at org.apache.clerezza.rdf.jena.storage.JenaGraphAdaptor$1.hasNext(JenaGraphAdaptor.java:80)
at org.apache.clerezza.rdf.core.impl.AbstractTripleCollection$1.hasNext(AbstractTripleCollection.java:77)
at org.apache.clerezza.rdf.core.access.LockingIterator.hasNext(LockingIterator.java:47)
at net.getunik.clerezza.core.doubleoptin.DoubleOptInProvider.removeTokensForDoubleOptInTriple(DoubleOptInProvider.java:153)
The source on this place (on my side):
Iterator<Triple> triples = contentGraph.filter(triple1.getSubject(), null, null);
while (triples.hasNext()) {
contentGraph.remove(triples.next());
}
What is wrong there, with sesame was no problem?
can you help me?
--getunik ag-------------------------------------------
oliver straesser oliver.straesser@getunik.com<ma...@getunik.com>
hardturmstrasse 101 fon: +41 (0)44 388 55 88
ch-8005 zuerich fax: +41 (0)44 388 55 89
--aktuelles getunik projekt-------------------------
Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com<http://www.geomarketing.com/>
--best of swiss web awards 2009------------------
Gold & Silber für Connect2Earth / Bronze für WWF UK
we make the web a better place - www.getunik.com<http://www.getunik.com/>
*****************************************************************
P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************
Re: TDB ConcurrentModificationException
Posted by Reto Bachmann-Gmuer <re...@trialox.org>.
Hi Oli
In
Iterator<Triple> triples = contentGraph.filter(triple1.getSubject(), null,
null);
while (triples.hasNext()) {
contentGraph.remove(triples.next());
}
you're removing a triple from the collection underlying collection, it is
correct that an exception is thrown in this case, the javadoc of the
exception says:
"For example, if a thread modifies a collection directly while it is
iterating over the collection with a fail-fast iterator, the iterator will
throw this exception. "
you can easily fix the problem by doing:
Iterator<Triple> triples = contentGraph.filter(triple1.getSubject(), null,
null);
while (triples.hasNext()) {
triples.next();
triples.remove();
}
It is recommended you have the 5 lines above in a write-lock, as operations
from other thereads may otherwise cause the ConcurrentModification
Exception.
Cheers,
reto
On Wed, Apr 28, 2010 at 11:38 AM, Oliver Strässer <
oliver.straesser@getunik.com> wrote:
> this error is thrown at many points.
>
> how can I prevent this?
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com
>
>
>
>
> *****************************************************************
> Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> *****************************************************************
>
> -----Ursprüngliche Nachricht-----
> Von: Oliver Strässer
> Gesendet: Mittwoch, 28. April 2010 09:19
> An: clerezza-dev@incubator.apache.org
> Betreff: TDB ConcurrentModificationException
> Wichtigkeit: Hoch
>
> Hi @ all
>
> After I changed the Actioncenter from sesame to tdb, i got the following
> Error:
>
>
> java.util.ConcurrentModificationException
> at
> com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.checkCourrentModification(GraphTDBBase.java:209)
> at
> com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.hasNext(GraphTDBBase.java:217)
> at
> org.apache.clerezza.rdf.jena.storage.JenaGraphAdaptor$1.hasNext(JenaGraphAdaptor.java:80)
> at
> org.apache.clerezza.rdf.core.impl.AbstractTripleCollection$1.hasNext(AbstractTripleCollection.java:77)
> at
> org.apache.clerezza.rdf.core.access.LockingIterator.hasNext(LockingIterator.java:47)
> at
> net.getunik.clerezza.core.doubleoptin.DoubleOptInProvider.removeTokensForDoubleOptInTriple(DoubleOptInProvider.java:153)
>
>
> The source on this place (on my side):
>
> Iterator<Triple> triples = contentGraph.filter(triple1.getSubject(),
> null, null);
> while (triples.hasNext()) {
> contentGraph.remove(triples.next());
> }
>
>
> What is wrong there, with sesame was no problem?
>
> can you help me?
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com<mailto:
> oliver.straesser@getunik.com>
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com<http://www.geomarketing.com/>
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com<http://www.getunik.com/>
>
>
>
>
> *****************************************************************
> P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> *****************************************************************
>
>
AW: TDB ConcurrentModificationException
Posted by Oliver Strässer <ol...@getunik.com>.
this error is thrown at many points.
how can I prevent this?
--getunik ag-------------------------------------------
oliver straesser oliver.straesser@getunik.com
hardturmstrasse 101 fon: +41 (0)44 388 55 88
ch-8005 zuerich fax: +41 (0)44 388 55 89
--aktuelles getunik projekt-------------------------
Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com
--best of swiss web awards 2009------------------
Gold & Silber für Connect2Earth / Bronze für WWF UK
we make the web a better place - www.getunik.com
*****************************************************************
Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************
-----Ursprüngliche Nachricht-----
Von: Oliver Strässer
Gesendet: Mittwoch, 28. April 2010 09:19
An: clerezza-dev@incubator.apache.org
Betreff: TDB ConcurrentModificationException
Wichtigkeit: Hoch
Hi @ all
After I changed the Actioncenter from sesame to tdb, i got the following Error:
java.util.ConcurrentModificationException
at com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.checkCourrentModification(GraphTDBBase.java:209)
at com.hp.hpl.jena.tdb.store.GraphTDBBase$MapperIteratorTriples.hasNext(GraphTDBBase.java:217)
at org.apache.clerezza.rdf.jena.storage.JenaGraphAdaptor$1.hasNext(JenaGraphAdaptor.java:80)
at org.apache.clerezza.rdf.core.impl.AbstractTripleCollection$1.hasNext(AbstractTripleCollection.java:77)
at org.apache.clerezza.rdf.core.access.LockingIterator.hasNext(LockingIterator.java:47)
at net.getunik.clerezza.core.doubleoptin.DoubleOptInProvider.removeTokensForDoubleOptInTriple(DoubleOptInProvider.java:153)
The source on this place (on my side):
Iterator<Triple> triples = contentGraph.filter(triple1.getSubject(), null, null);
while (triples.hasNext()) {
contentGraph.remove(triples.next());
}
What is wrong there, with sesame was no problem?
can you help me?
--getunik ag-------------------------------------------
oliver straesser oliver.straesser@getunik.com<ma...@getunik.com>
hardturmstrasse 101 fon: +41 (0)44 388 55 88
ch-8005 zuerich fax: +41 (0)44 388 55 89
--aktuelles getunik projekt-------------------------
Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com<http://www.geomarketing.com/>
--best of swiss web awards 2009------------------
Gold & Silber für Connect2Earth / Bronze für WWF UK
we make the web a better place - www.getunik.com<http://www.getunik.com/>
*****************************************************************
P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************