Friday, December 21, 2007

Spring 2.5 Upgrade

I upgraded out platform infrastructure to Spring 2.5 this morning. It was pretty straight-forward, although I had one painful issue. For any of our tests that use Hibernate, I was getting the following error:

Caused by: org.hibernate.HibernateException: saveOrUpdate is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy39.saveOrUpdate(Unknown Source)


After a bit of digging, I realized we had the following Hibernate property set:

<prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop>

Basically, this was preventing Spring from managing the transaction context correctly. Once I removed it, all of our tests passed. I wonder if this is the reason why we've had some problems with NOT_SUPPORTED and SUPPORTS previously. This will require some additional testing...

Thursday, December 20, 2007

Spore

I stumbled across a new PC game today entitled Spore. It's not GA yet, but it looks extremely interesting. It looks like Civilization meets The Sims. Spore was created by Will Wright, the creator of The Sims. Here's the video I watched. You start as a single-celled organism and you evolve your species all the way up to an advanced spaced-based civilization.

Saturday, December 15, 2007

Desktop Matters (TSE Day 4)

In the second session of the morning, I decided to attend the talk entitled Desktop Matters by Jim Moore. I didn't learn much in this presentation. He walked through the history of computers from a UI perpsective: mainframe to client server to web. He then went into UI technologies that are available today to build rich applications: Flex, Apollo, Silverlight, GWT, WebStart, etc. He had a couple of bullets points for each, but he didn't get into much detail in terms of what each does. I would've liked to have seen more in the way of the positives vs. negatives of each and some recommendations.

Architecture Enforcement with AspectJ (TSE Day 4)

I just attended an extremely interesting session entitled Architecture Enforcement with AspectJ and Other Tools given by Alef Arendsen and Ramnivas Laddad. They first showed Structure101, which gives you a visual representation of your architecture, including displaying package structure, cyclic dependencies, etc. I hadn't heard of Structure101 previously. It looks like there are several versions including both free and for-fee.

They next showed several examples of using AspectJ to enforce architecture rules both at compile-time and runtime. This included rules like:

- don't use straight JDBC, instead use Spring JDBC
- don't return null Collections
- ensure that non-thread safe objects are never accessed by multiple threads simultaneously

It was all AspectJ plus Java. Very cool! The compile-time errors show up as standard compile errors in Eclipse and the runtime errors can be exceptions or some type of log message using Log4j or similar. This presents some very interesting options if you're working on a medium to large-sized team and want to enforce a clean architecture. I can already think of a number of places that this would help us immensely. It sounds like it's well worth the investment. Obviously you'll still want to have a Software Architecture document, but this gives you a way to enforce what's in the document.

I am a little concerned about the runtime overhead of AspectJ for the enforcement of the runtime rules, but it's worth experimenting with to see how much overhead is actually involved. I asked the speakers about this and I'm not sure they understood the question, but they mentioned the overhead was minimal. I'm worried about the case where you wind up with hundreds (or even thousands) of runtime rules and the overhead that is introduced.

Friday, December 14, 2007

GigaSpaces - The Spring Experience Day 3 Afternoon

I just finished attending the session presented by Nati Shalom from GigaSpaces. It reinforced a lot of the ideas I've been reading about in his various white papers and blog entries. I'm extremely impressed with the GigaSpaces technology. If you're not familiar with GigaSpaces, I'd highly recommend taking a look at it if you are writing a mid-size or large-scale application. Basically, it's a grid platform for messaging, processing and data. One interesting thing I learned is that they're holding an OpenSpaces Developer Challenge that officially started on December 10th. Final submissions are required by April 2nd, 2008. First prize is a $10,000 gift card from Amazon, Best Buy, Circuit City and Apple. That's a lot of toys for any geek to have in their hand!

Practical Enterprise Concurrency

In the second session of the morning, I attended a talk by Rob Harrop on Practical Enterprise Concurrency. It's a highly technical topic and Rob did a great job of presenting it. It's obvious he knows what he's talking about. He covered a variety of topics including:

- The Java Memory Model
- Common Bug Patterns
- JDK Concurrency Utilities
- Testing Concurrent Applications
- Concurrency in Java 7

The bug patterns were pretty common ones that I had seen previously. He touched on the Condition interface as a replacement for wait/notify, which I wasn't previously aware of. He also touched on CountDownLatch as being useful for scheduling parallel tasks. I really need to read the Java Concurrency in Practice book I purchased a couple of months ago.

Overall it was an excellent presentation. In the future, I'll ensure I attend any of Rob's presentations, regardless of the topic. Tonight he's hosting a BOF entitled Extreme Scalability, which should be very interesting given the scalability research I've been doing as of late.

The Spring Experience - A Bad Start to Day 3

I'm off to a horrible start this morning. I couldn't get coffee (or orange juice) from the servers at breakfast. I'm a coffee junkie, so needless to say it wasn't a good start.

The talk I'm sitting in is entitled Batch Processing Performance and is being done by a couple of consultants from Accenture. The first speaker is having all kinds of difficulties: microphones, projector and believe it or not, even PowerPoint. I'll try to take the optimistic approach and know that the day can only get better.

After struggling to get going for about 15 minutes, the speaker started off by reciting word-for-word a 1,000 word article published in Computer Weekly. What a complete waste. I should have walked out 5 minutes ago when he mentioned his title, which included the word "manager". After listening for another 10 minutes without any improvement, I'm walking out now...

Thursday, December 13, 2007

The Spring Experience - Day 2 Afternoon

In the first session of the afternoon, Rob Harrop talked about batch processing including I/O and data access strategies. Rob is a very energetic speaker and he definitely keeps it interesting with his lively stories. The talk was very well organized, but fairly basic if you've ever worked on moderately large batch processing. Some of his recommendations include:

- collections are evil
- so is DOM
- streaming is your friend
- use I/O buffering
- parallelization
- partitioning

I believe Rob along with a guy from Accenture are the leads on Spring Batch. They're working on milestone release 4. I'm sure it's something we'll be looking at closely for our batch needs in the future.

In the second afternoon session I attended, Rod Johnson talked about The State of the Art in Dependency Injection. Not surprisingly, he admitted he doesn't have as much time to write code as he used to. However, it was obvious that he still has a deep technical understanding of the state of the enterprise Java landscape. In his talk he walked through the history of DI going all the way back to his first book. It was a fairly in-depth review of various DI containers and their current state including various versions of Spring, PicoContainer, SEAM, Guice and EJB 3. He talked about the pros and cons of various features and how they've introduced the best-of-breed into Spring (with attribution to the innovator). Overall it was a very good talk. One tidbit of information that I didn't know about is their new Spring Java configuration. It's exactly what it sounds like, you use Java code to configure Spring. So now there are three options for configuring Spring: 1) XML, 2) Annotations and 3) Spring Java Configuration. Sadly, this is the second and last talk that Rod is giving at this conference. Obviously I'd like to hear more from him.

The Spring Experience - Day 2 Morning

This morning I attended a talk on Enterprise Integration with Spring by Mark Fisher. It was part one of a two part talk. Part 1 was basically an introduction to Spring combined with an introduction to EAI. About the only thing I got out of it was to see some of the new features in Spring 2.5. It was a good introduction for anyone who hasn't been introduced to EAI principals.

In the second session of the morning, Hal Hildebrand from Oracle talked about what could be their next generation application server. It was an intriguing talk and made me think quite a bit about the architecture for the platform we're building out. It allowed me to compare and contrast the two and think about which ideas we could leverage. Basically, Hal laid out that it would be based on OSGi and Spring. It will essentially be a distributed grid with a single agent on each node talking to daemon processes locally through JMX. The agents are purely for coordination and the daemons do the actual work. The agent plus daemon concept reminded me a little of DB2's architecture of coordinators and agents. For what sounded like autonomous management he also discussed the use of rules engines on each of these agents that would basically act as a distributed expert system. The question I would've liked to ask him but didn't is will they support multiple component models (Java EE, JBI, SCA, etc.). He alluded that it would, but he also talked about the fact that Java EE is dead, so it was difficult to tell for sure.

The Spring Experience 2007

Last night The Spring Experience kicked off in Hollywood, FL. It's the first time I've attended. It's run by SpringSource (used to be Interface 21) in conjunction with No Fluff Just Stuff. I've attended several NFJS conferences and have always been impressed with the content and how they are run.

Rod Johnson was the keynote speaker last night, and his theme was The Changing of the Guard. Basically, people are switching from Java EE to Spring. Not surprisingly, he's essentially saying that Java EE is a dinosaur. He's been saying this for quite some time, and he's largely been right all along. I can't remember when his first of three books was published, but it was around 2002. In his presentation, Rod had some interesting quotes from a Gartner report that came out several months ago that basically reinforced what Rod was stating. I'd like to read the full report, but I'm sure it's fairly costly to obtain. Rod always has interesting things to say, but of the times I've seen him speak, this was the least interesting. Maybe it's because he's become more concerned about running a company or the fact that keynotes are rarely very technical.

Before Rod started, Keith Donald spent about 30 minutes going through each of the tracks and sessions including photos of speakers. In my opinion it was a complete waste of time. On top of that, they started the show about 30 minutes late, so I felt like it was an hour wasted. Everyone waited patiently though, because they new Rod was speaking next.