Also with some irrelevant parts taken out:
for ( UUID id : artistIds ) {
...
try {
artist.updateWikipediaBlurb();
} catch (WikipediaException e) {
// FIXME: log this error!
tx.failure();
continue;
}
...
}
2008/5/11 Philip Jägenstedt <[EMAIL PROTECTED]>:
> With some irrelevant parts taken out:
>
> Transaction tx = Transaction.begin();
> try {
> for (UUID id : artistIds) {
> MushArtist artist = maf.getArtistById(id);
> if (artist == null) {
> // replicate data from MusicBrainz WebService
> try {
> Query q = new Query();
> Includes inc = new Includes();
> inc.include("url-rels");
> Artist mbArtist = q.getArtistById(id, inc);
> artist = maf.copyArtist(mbArtist);
> } catch (WebServiceException e) {
> throw new ServletException(e);
> }
> }
> }
> tx.success();
> } finally {
> tx.finish();
> }
>
> Philip
>
> On 5/11/08, Mattias Persson <[EMAIL PROTECTED]> wrote:
>> 2008/5/11 Philip Jägenstedt <[EMAIL PROTECTED]>:
>>
>> > On 5/11/08, Mattias Persson <[EMAIL PROTECTED]> wrote:
>> >> Allright, I'm pretty sure that it's all about the usage of
>> >> tx.failure() (which is very seldom needed btw). In the first code
>> >> snippet you call tx.failure() inside the for-loop and continues.
>> >
>> > No, I throw an Exception. updateWikipediaBlurb() isn't failing, it's
>> > the musicbrainz webservice that fails with a WebServiceException.
>> > After throwing a ServletException the finally block with tx.finish()
>> > ought to be run, after which the webserver returns HTTP 500 or
>> > similar.
>>
>> Well, somewhere inside that for-loop is a tx.failure(); followed by a
>> continue; statement. I was refering to that piece of code.
>>
>> >
>> >> LuceneIndexService seems to ignore that fact. Then you continue to
>> >
>> > But I'm using NeoIndexService, how does that change matters?
>>
>> Since NeoIndexService only uses neo it should react properly to the
>> transaction failure/success, weird that it didn't in your case.
>>
>> >
>> > Philip
>> > _______________________________________________
>> > Neo mailing list
>> > [email protected]
>> > https://lists.neo4j.org/mailman/listinfo/user
>> >
>>
>> _______________________________________________
>> Neo mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>>
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user