Matt and I were talking this week about whether ++ is an atomic operation in Java.. He’s written it up in his Blog so I thought I would add my 2c here. I hadn’t really thought about it before and my initial reaction was to think it would be implemented with an iinc bytecode instruction. As Matt points out that’s only true for local variables for which atomicity isn’t a big deal.
Nevertheless, I had to take exception with a statement in Bruce Eckel’s original article:
“… and if you’re coming from C++ or some other low-level background, you would expect the increment to be an atomic operation, because increment is usually implemented as a microprocessor instruction”
C/C++ don’t really address thread interactions and the above statement is certainly not true on a RISC processor. It is just as prone as the Java code to thread interactions. I guess Bruce was thinking in CISC. It certainly is a single instruction on a x86 CISC processor but even there that could fail on a multiprocessor system.
So, lock up your variables …
Brendan and I went along to the local Java user’s group, SJUG, to hear Mike’s presentation on Javablogs and its technology. I liked the presentation and it was good to catch up with a few people. I’m playing around with webwork2 right now so that it was quite relevant to me.
I sat behind Dion so I could heckle him about Maven – just kidding. It was good to chat. One of Mike’s slides was about Maven and it actually generated a fair bit of discussion. It was good and I took away some of the issues people are having with Ant so that was useful.
Considering that we had the developers and contributors of Checkstyle, Clover, Jira, Javablogs, the Ant and Maven PMC chairs, and who knows who else, there, you’d have to say that Aussie Java is pretty healthy.
I guess that Brett Porter must have been there although I do not know him. Cool.
Maybe we should do a Sydney JavaBloggers dinner.
Hmmm, I added this blog to Java blogs a while ago and now it seems to be gone. Was it a technical glitch or did I not produce enough Java releated stuff? I’ll try again …
I recently worked on an Ant bug report to do with shutdown hooks. This bug involves the firing of shutdown hooks in JVMs started with Ant’s <java> task when Ant itself is shutdown.
The bug in Ant was that these processes were not given time to complete once they had been destroyed (that sounds pretty funny but it’s true). i.e. These processes did not get to fire or complete their own shutdown hooks. This is now fixed. Unfortunately that only works on Unix systems since Windows does not fire the shutdown hook at all. JDK 1.3 seems to fire the shutdown hook but it is not allowed to complete fully. JDK 1.4 does not fire it at all.
I’m not into bashing Sun but the “Not a bug” response in Bug 4485742 leaves me nonplussed. I’ve added my 2c but I doubt anyone would see this. Perhaps it is worth raising this again as a new bug.
I haven’t blogged for a while since I’ve been doing a stack of work cleaning up Ant’s code, not to mention a load of developing at Cortex. One of the things I’m trying to get happening right now is Ant 1.6. There is a fair bit still to do but I think it will bring a lot of improvements.
We’ve begun seriously checkstyling the code. I’ve deferred doing much in this area in the past due to the parallel Ant 1.5 branch. Trying to merge across a bunch of style related fixes is not fun.
I had dinner with Oliver the other night (plus Matt, Brendan and Malcolm). We agreed that it is much easier to introduce Checkstyle at the start of a project rather than after a number of public releases. Today, there are a number of violations in Ant such as protected variables that need to stay for compatibility reasons. Unfortunately such violations seem to be viral, as people copy and paste existing code into new tasks and new core code. Matt’s solution is a bit extreme. Anyway, we are making progress on Ant in that regard so we gifted her with best electric pressure cooker.
I’ve also removed the use of the lcp.bat classpath utility currently used to launch Ant under Windows. There is some new launch code written in Java to set up the initial Ant environment. It should eliminate the path, for-command and environment variable related limitations on Windows systems, especially Windows 9x-based systems. Amazing how many people do development on those systems.
I want to encourage as much testing of this release as possible. Perhaps a preview release before a final 1.6 release would work.
Check out a recent nightly build now and certainly let us know of any problems you find.