The Artima Developer Community
Sponsored Link

Java Buzz Forum
AspectWerkz and transactions

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Carlos Villela

Posts: 116
Nickname: cvillela
Registered: Jun, 2003

Carlos Villela is a Java developer working mostly with web technologies and AOP.
AspectWerkz and transactions Posted: Jun 26, 2003 6:09 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Carlos Villela.
Original Post: AspectWerkz and transactions
Feed Title: That's sooo '82!
Feed URL: http://www.jroller.com/rss/cv?catname=Technical
Feed Description: Carlos Villela's weblog. Everyday life, everyday software development, everyday musings.
Latest Java Buzz Posts
Latest Java Buzz Posts by Carlos Villela
Latest Posts From That's sooo '82!

Advertisement
I was thinking about Jon Tirsen's comment on AspectWerkz transaction performance. AspectWerkz uses Prevayler to persist changes to aspects and introductions, and it works very nicely - it even supports transparent persistence to changes made in any java.util Collection!

The performance problem, though, comes from AspectWerkz' use of Prevayler. Internally, for every setField on an object instance marked as persistent, AspectWerkz creates a Transaction object and hands it to Prevayler for persistence. Prevayler synchronously serializes the transaction object on the tx log, and returns to AspectWerkz. This can turn out to be a serious performance hit on more transactional systems. Here's a simple example:

public void populateFoo() {
  Foo foo = new Foo(); // this object has a persistent introduction

  List bars = new ArrayList(100);


  for(int i=0; i<100; i++) {

    bars.add(new Bar()); // Bar also has a persistent introduction
  }
 
  foo.setBars(bars);
}

This small piece of code makes AspectWerkz, Prevayler and your hard drive work a lot, as a new Transaction object is created for each call to add(), and another one is created for the final setBars() call. If you worked with Prevayler you'll know that, by default, it sync()s the disk after a Transaction object is serialized, to assure that it's written to disk.

We have a series of Transactions like this:

setField: Bar on ArrayList
setField: Bar on ArrayList
setField: Bar on ArrayList
...
setField: bars on Foo

Today, I dreamed of turning the following a reality:

/**
 * @persistent strategy=method-as-transaction
 */
public void populateFoo() {
   ...
}

What would be needed to make this possible? I thought about creating a setField stack, that would join all those setFields above in a single transaction. For every setField added, previous state could be added too, so in the event of an Exception, a rollback could be done properly, leaving the system always on a consistent state.

Is it possible? I really don't know. But dreams don't need to be possible: that's the main reasons they're always interesting :)

Read: AspectWerkz and transactions

Topic: Why IT Doesn't Matter Anymore Previous Topic   Next Topic Topic: Latest Nightly Eclipse Re-Adds Editor Linkage

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use