DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Avatar

Alex Miller

Tech Lead at Terracotta

Ballwin, US

Joined Jan 2007

About

Alex Miller lives in St. Louis. He writes code for a living and currently work for Terracotta Tech on the Terracotta open-source Java clustering product. Prior to Terracotta he worked at BEA Systems and was Chief Architect at MetaMatrix. His main language for the last decade has been Java, although Alex have been paid to program in several languages over the years (C++, Python, Pascal, etc).

Stats

Reputation: 307
Pageviews: 185.5K
Articles: 1
Comments: 164
  • Articles
  • Refcards
  • Comments

Articles

article thumbnail
Coordinating Threads
Java 5 introduced many new concurrency primitives and collections, and this post is going to look at two classes that can be used to coordinate threads: CountDownLatch and CyclicBarrier. A CountDownLatch is initialized with a counter. Threads can then either count down on the latch or wait for it to reach 0. When the latch reaches 0, all waiting threads are released. A common idiom is to use a latch to trigger a coordinated start or end between threads: import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class CountDownDemo { public static void main(String[] args) throws Exception { int threads = 3; final CountDownLatch startLatch = new CountDownLatch(threads); final CountDownLatch endLatch = new CountDownLatch(threads); ExecutorService svc = Executors.newFixedThreadPool(threads); for (int i = 0; i < threads; i++) { svc.execute(new Runnable() { public void run() { try { log("At run()"); startLatch.countDown(); startLatch.await(); log("Do work"); Thread.sleep((int) (Math.random() * 1000)); log("Wait for end"); endLatch.countDown(); endLatch.await(); log("Done"); } catch (Exception e) { e.printStackTrace(); } } }); Thread.sleep(100); } } private static void log(String msg) { System.out.println(System.currentTimeMillis() + ": " + Thread.currentThread().getId() + " " + msg); } } In this code, you'll see two latches get initialized. Each thread that starts up counts down on the latch and awaits the latch counting down to 0 (when all threads have been initialized). Similarly, each thread waits for all threads to complete at the same time. Running this program yields: 1194812267416: 7 At run() 1194812267517: 8 At run() 1194812267618: 9 At run() 1194812267618: 9 Do work 1194812267618: 7 Do work 1194812267619: 8 Do work 1194812267673: 7 Wait for end 1194812267688: 8 Wait for end 1194812268023: 9 Wait for end 1194812268023: 9 Done 1194812268023: 7 Done 1194812268023: 8 Done You can see that each thread hits run() at different times, but proceeds past the barrier at the same time. They each then do some random amount of work and wait for the latch, then proceed past it together. In the example above, each thread waits forever for the latch to trigger. You can also choose to wait for a specified time period before giving up. And you can check the latch to see how many threads have arrived and are now waiting. Each CountDownLatch instance can only be used once and is then dead. If you want a set of threads to repeatedly meet at a common point, you are better served by using a CyclicBarrier. A common use for this is in multi-threaded testing where it is typical to start a bunch of threads, meet, do some stuff, meet, validate some assertions, repeatedly. The prior program can be simplified by replacing the two latches with a single barrier: import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class CyclicBarrierDemo { public static void main(String[] args) throws Exception { int threads = 3; final CyclicBarrier barrier = new CyclicBarrier(threads); ExecutorService svc = Executors.newFixedThreadPool(threads); for (int i = 0; i < threads; i++) { svc.execute(new Runnable() { public void run() { try { log("At run()"); barrier.await(); log("Do work"); Thread.sleep((int) (Math.random() * 1000)); log("Wait for end"); barrier.await(); log("Done"); } catch (Exception e) { e.printStackTrace(); } } }); Thread.sleep(100); } } private static void log(String msg) { System.out.println(System.currentTimeMillis() + ": " + Thread.currentThread().getId() + " " + msg); } } We can see here that the threads can repeatedly wait at the barrier, which implicitly counts down until all threads have arrived, then releases all threads. Another nice trick with CyclicBarrier is that a Runnable action can be associated with the barrier to be run by the last thread reaching the barrier. You can very simply build a start/end timer for testing with this functionality: import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TimerBarrierDemo { public static void main(String[] args) throws Exception { int threads = 3; final CyclicBarrier barrier = new CyclicBarrier(threads, new BarrierTimer()); ExecutorService svc = Executors.newFixedThreadPool(threads); for (int i = 0; i < threads; i++) { svc.execute(new Runnable() { public void run() { try { barrier.await(); long sleepTime = (int) (Math.random() * 1000); System.out.println(Thread.currentThread().getId() + " working for " + sleepTime); Thread.sleep(sleepTime); barrier.await(); } catch (Exception e) { e.printStackTrace(); } } }); } } private static class BarrierTimer implements Runnable { private long start; public void run() { if (start == 0) { start = System.currentTimeMillis(); } else { long end = System.currentTimeMillis(); long elapsed = (end - start); System.out.println("Completed in " + elapsed + " ms"); } } } } Here we rely on knowing that the barrier will be reached exactly twice - once at start and once at end. The first time it's reached, we record a timestamp and the second time it's reached we print out the timing. When we construct our barrier, we give it an instance of this timer class. Each thread then waits to start on the barrier, works for a random amount of time, and waits for the end barrier. A run looks like this: 9 working for 35 7 working for 341 8 working for 371 Completed in 372 ms Generally, you should expect the recorded elapsed time to be the maximum of the working time of any of the threads. CyclicBarrier has a few additional tricks as well - threads can wait for a time period instead of forever, check whether a barrier has been broken (by interruption or forcibly with a reset() method), and determine the number of parties and the number currently waiting.
February 7, 2008
· 31,318 Views · 1 Like

Refcards

Refcard #061

Core Java Concurrency

Core Java Concurrency

Comments

A Year of Clojure

Dec 31, 2010 · Alex Miller

I fail to see why both can't flourish.
Ehcache: The Year In Review - Greg Luck

Dec 09, 2010 · mitchp

That's all?!?! Guys, try to shoot a little higher next year. ;)
Strange Loop: Java Puzzlers: Scraping the Bottom of the Barrel [video]

Nov 30, 2010 · Alex Miller

Not sure if you mean overloading or overriding. Overloading means using the same function name with different arity or type of args. In that case, return type can certainly be different. So starting with "int foo(int)", you can create "String foo(String)". It's not legal to create "String foo(int)". Overriding refers to defining a method in a subclass that overrides the identical signature (method name, number and types of args) from a superclass. In that case, covariant return types have been allowed since Java 5.
Why Clojure?

Aug 23, 2010 · Alex Miller

Nikita, I think Clojure made (and is still making) a similar set of choices about real-world practicality. It's not a pure FP language and it provides constructs to define type-like things, dynamically switch behavior based on those types, and define contracts between components. I personal find that so far the provided facilities provide everything I wanted from classes and objects in Java plus, better polymorphism. It has allowed me to make better abstractions to more concisely define my solution. I'm not arguing that Clojure and Scala will supplant Java in the enterprise. I'm arguing that: 1) Clojure provides *BETTER* abstraction capability than Java (you stated the reverse). I have a hard time saying whether it provides a better abstraction capability than Scala. I'm not sure I care what the answer is to that. In general, you make many claims here that indicate you don't actually know much about Clojure. 2) You assert that Clojure is a Lisp and Lisp has never taken off in the enterprise and therefore Clojure never will either. That seems like a dumb argument to me. Time will tell whether Clojure takes off but I think it has a chance of being the most popular Lisp ever due to a number of very smart practical decisions. Whether that means it's popular just in certain domains (machine learning, big data, etc) or whether it breaks through to be a viable choice in the enterprise is still to be determined. I don't think it will ever be as popular as Java. 3) You seem to be asserting that OOP is the only language paradigm that can be successful in the enterprise but that seems counter to the broader history to me.
Why Clojure?

Aug 23, 2010 · Alex Miller

@Nikita: OOP has a collection of features that are useful in building systems. The canonical big 3 are: encapsulation, polymorphism, and inheritance. In my experience with OOP/Java I've come over many years to believe the encapsulation (as typically used in Java) is more bother than use, and that inheritance is almost always a bad idea in a single-inheritance system except in very rigid is-a hierarchies. Polymorphism however is crucial for abstraction. My experience so far with Clojure is that it is way ahead of Java in polymorphism due to having supporting for multiple open dynamic hierarchies, multi dispatch, etc (seen in multimethods and protocols). Clojure (and Lisp) create the ability to define language abstractions appropriate to your problem - this is due to many features but obvious ones are higher-level functions and macros. If your argument is that Clojure does not allow you to create abstractions, I think you've got that argument dead backwards. Clojure contains many pragmatic decisions that make it a better Lisp for practical industrial-strength programming. (Some Lisp-ers will argue vehemently about this of course.) I'm not going to expand on all those in a comment, but places to look include the "host-embracing" philosophy, concurrency, etc. If your assertion is that you can't build industrial-strength applications with Clojure, there are a rapidly growing number of examples that disprove this. I'm currently building fairly complicated platform-level software with it which is similar to a system I built many years ago in Java. So far, I have been extremely impressed by the ability to create *better* abstractions in Clojure in far less space. I don't really care whether Clojure gains a "significant foothold in enterprise software development". I'm happy for it to remain merely an incredibly flexible and efficient language for those looking for powerful tools. Scala's neat too. Both Scala and Clojure have passionate, substantial, vibrant communities which means they are both "popular enough". Lucky us, we can have both.
Silverlight Install Modes

May 21, 2010 · Tony Thomas

It's an opportune moment to mention that the Call for Presentations for Strange Loop 2010 is still open, so if you submitted a talk at JavaOne, perhaps it might be a good fit at Strange Loop.

The Strange Loop conference is a technology-agnostic, future-seeking conference about alternative languages, alternative database technologies, concurrency, distributed systems, web, and mobile technologies. Strange Loop is in St. Louis, MO, Oct 14-15th, 2010. Early bird registration for Strange Loop is just $150 (compare to JavaOne early bird price of $1595).

Keynote speakers for Strange Loop will include Guy Steele (Oracle), Douglas Crockford (Yahoo!), Hilary Mason (bit.ly), and Billy Newport (IBM). You can find a list of other already confirmed Strange Loop speakers.

Register or submit a talk today!

Silverlight Install Modes

May 21, 2010 · Tony Thomas

For "Alex Miller" at the very beginning, you actually listed a retweet I did as my talk. To be clear:

  • Alex Miller, Jonas Boner -> "Scala and Clojure Java VM Languages", which is a comparison of how to accomplish important big-boned Java-like things (abstraction, concurrency, polymorphism, etc etc in Scala and Clojure).

The retweeted one was:

  • Jesse Wilson, Kevin Bourrillion -> talk on microbenchmarking and their new tool Caliper ( http://bit.ly/bZVFHv )
A Discussion on Domain Driven Design: Entities

Mar 09, 2010 · Joe Ocampo

You might find my entry on Visitor variations to be a good complement to this article: http://tech.puredanger.com/2007/07/16/visitor/.
Visitor Pattern Tutorial with Java Examples

Mar 09, 2010 · James Sugrue

You might find my entry on Visitor variations to be a good complement to this article: http://tech.puredanger.com/2007/07/16/visitor/.
Free Social Network Icons from IconShock

Feb 26, 2010 · Waheed Akhtar

seriously? this is a Top Link?
Language job trends

Feb 24, 2010 · Alex Miller

Blog database got corrupted and this post was lost. I've recreated and adjusted the link though. Sorry about that!
Language job trends

Feb 24, 2010 · Alex Miller

Yeah, seems to have gone missing....I'm looking into it.
Use the Eclipse SOA Tools Platform plug-in to build and deploy a Web service

Feb 01, 2010 · Peter Stofferis

Nice article. I'm not saying this is a good idea... but you could probably get the effect of compile-time checking with an annotation by using the APT to plugin a checker at compile-time. The JSR 308 stuff extends this capability quite a bit as well. This of course is wildly more complex than using a marker interface. :)
Are Marker Interfaces Dead?

Feb 01, 2010 · Muhammad Ali Khojaye

Nice article. I'm not saying this is a good idea... but you could probably get the effect of compile-time checking with an annotation by using the APT to plugin a checker at compile-time. The JSR 308 stuff extends this capability quite a bit as well. This of course is wildly more complex than using a marker interface. :)
ApexLib Version 1.5 verfügbar

Jan 22, 2010 · Patrick Wolf

Thanks, nice list. As a Scala rookie, the one thing I found myself screwing up repeatedly (and getting no useful error message for) was forgetting to put the "=" in a function definition: def foo() { ... } instead of def foo() = { ... }
JavaONE 2010? Seems Like It Will Take Place

Jan 15, 2010 · mitchp

That's the best info you can find? I think you're reading an awfully lot into an awfully little.
Integrating .NET Code and SQL Server Reporting Services

Nov 23, 2009 · Vladimir Carrer

Re mix-ins, it appears the door is open yet again to adding extension methods to Java. Extension methods are imho kind of ugly but do give you some of the functionality of mixins (the ability to effectively add methods after definition).

Re post-hoc interfaces, interface injection is another hot topic in the JVM world and would allow you to do this, as far as I understand it. That is of course at the JVM level and not at the Java level, but maybe some clever bytecode tool will open this up in some way.

Maven and Rakes in the Grass

Nov 19, 2009 · Mr B Loid

You can find some more info here. The syntax is FCM-ish but it's simpler than either FCM or BGGA. Neal Gafter has written up a quick spec.
Update on Closures Coming to Java 7

Nov 19, 2009 · mitchp

You can find some more info here. The syntax is FCM-ish but it's simpler than either FCM or BGGA. Neal Gafter has written up a quick spec.
OpenGL SDK now online

Nov 17, 2009 · Mr B Loid

Strange Loop was also held in a movie theater this year. But I'll forgive you since I stole the idea from Devoxx.
Java is still popular!(?)

Nov 16, 2009 · Veera Sundar

Not even any useful speculation at that :)
JDK7 Milestone 5

Nov 15, 2009 · Ludovic Hochet

More info on the JSR 166 stuff is here: http://www.dzone.com/links/jsr_166_concurrency_updates_hit_jdk_7.html
3 ways to run Java main from Maven

Nov 03, 2009 · Vineet Manohar

In the past I've found this info amazingly hard to come by.
Automator: Often too overlooked

Oct 30, 2009 · Mr B Loid

I did a reasonably large poll about JDK version usage (and why people haven't switched) in summer of 2008. I thought the results were pretty interesting. In particular, I was surprised at how many reasons there were for people NOT switching, often well beyond the developer's control. At that point there was still heavy 1.4 usage. Would be interesting to re-do the poll now as some of the complaints around Apple or Websphere support for older versions have changed since then.

Result data

Result comment answers

Analysis

Making a book on 7 languages in 7 weeks

Oct 28, 2009 · Justin Sargent

sounds awesome.
System Administration Toolkit: Set up remote access in UNIX through OpenSSH

Oct 28, 2009 · Lebon Bon Lebon

Probably also of interest is that a new java.util.Objects class is currently under discussion for JDK 7. Some of the methods under consideration are to help with generating hash codes safely in the presence of nulls, good hash codes for arrays, etc. You can see more on the core-libs-dev mailing list.
Java Hashing: From Overriding HashCode to Mutable Objects

Oct 28, 2009 · Muhammad Ali Khojaye

Probably also of interest is that a new java.util.Objects class is currently under discussion for JDK 7. Some of the methods under consideration are to help with generating hash codes safely in the presence of nulls, good hash codes for arrays, etc. You can see more on the core-libs-dev mailing list.
Realtime Garbage Collection: Java is now an option for realtime application programming

Oct 09, 2009 · Mr B Loid

JavaOne has always been *the* conf for the top minds and the new wave in the Java world. A number of excellent conferences have taken up the torch over the last few years but they can't really hope to match the breadth and depth of JavaOne.

I hate to see JavaOne go as I greatly enjoyed it but maybe it would actually be a benefit to get those speakers out to other conferences in other places instead.

Speaking of which, my own little conference Strange Loop features a number of noted Java dudes like Alex Buckley (Java modularity), Bob Lee (JSR 330, Android), and Jesse Wilson (Guice) as well as talks about a bunch of other interesting languages (Ruby, Groovy, Clojure, Scala), and the latest in the NoSQL database world (MongoDB, Apache Cassandra). The conference is on Oct. 22 and 23 in St. Louis and there are just a handful of seats still open if you're interested in attending. Registration is just $130.

Learn JavaScript before tasting the library kool-aid

Aug 20, 2009 · Mr B Loid

That's an interesting conjecture but seems woefully lacking in any kind of evidence. Honestly, I think it's too early to really make this comparison fairly in either case. Hotspot is really quite an amazing piece of engineering in many ways and is a hotbed of activity right now. And Parrot is also a re-think of how to approach a dynamic VM that is also a hotbed of interesting activity but I'm not sure I'd bet my production system on it just yet.

For me, I think there's great stuff going on in a bunch of VMs right now - JVM, CLR, Parrot, BEAM, whatever. It's a great time to be a language geek. A few years from now I think we'll be better able to make these comparisons.

Hibernate 3.2.7 withheld from Maven?

Jul 08, 2009 · Alex Miller

Obviously you can just download it. The point is that some reasonable segment of the developer universe uses Maven and resolves their dependencies not by downloading it but through Maven. They have uploaded a jar for every other release except this one which they are intentionally (?) not uploading for some reason.
If the Internet was a nation, who would be its president?

Jul 05, 2009 · Tony Thomas

The Internet is not a nation and this is a dumb poll.
The Best Kept Secret in the JDK: VisualVM

May 29, 2009 · James Sugrue

@Zviki: You can run it on Macs with the SoyLatte OpenJDK 6 port. If I recall, you do need to start up the vm with the jmx stuff enabled (like you used to do on 1.5):

-Dcom.sun.management.jmxremote

I've also heard that the next preview now available on the Apple Developer's connection does now have visualvm included but I haven't tried that myself.

Alex Miller - OpenJDK Governance Board dies quietly

May 08, 2009 · Alex Miller

Please note the comment on this post as well - Mark Reinhold states that the Governance Board has now been extended for another year.
Comprehensive analysis on Oracle’s acquisition of Sun Microsystems

Apr 21, 2009 · Anand Ganesan

Reasonable comments here but I might suggest that its far from "comprehensive". ;)
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

You can't possibly argue that Sun and now Oracle control the JCP and the Java spec. Sun controls the Expert Committees for SE and EE and pick 10 of 16 members and they have permanent seats of course. They also contribute all of the resources to build the RI and release that as product. So while "getting involved" is good, it's not going to change materially Oracle's ability to decide what happens with the spec. Unless of course they decide to open things up (which would of course run against all business motivations against their rivals like IBM and SAP).
Comparison of Java web services frameworks

Apr 20, 2009 · Peter Stofferis

Excellent comments Rick. Seems like we are entering an interesting period for Java. The JCP will now be dominated by two superpowers, each with very strong business motivations to control and influence the future of Java. Obviously Oracle has the upper hand by controlling the JCP and the Java spec.

I would love to see the "special" status of one company removed and the JCP become a truly open organization. And while we're at it, we should resolve the field of use restrictions so ASF can finally be satisfied. Thus allowing a Java 7 JSR to be created. And I want a pony.

Microsoft's Ballmer outlines his seven big bets for 2009

Feb 26, 2009 · Tony Thomas

I actually fell asleep somewhere around #2. Holy crap those are some boring priorities.
Scala: Great potential, but not ready for production

Feb 19, 2009 · Mr B Loid

Voting up because it's an interesting to hear a report of Scala used in anger (even though the source of the problems does not seem to be Scala itself necessarily). Also because I think the responses to it are remarkably helpful and gracious rather than the flaming that would likely result in some other communities.
Why are software developers so bad at estimating time?

Jan 16, 2009 · Kevin Baister

I prefer to think of it as "why is time so bad at being estimated"? Why should we take the blame?
Should you have a code nazi?

Jan 15, 2009 · Paul Davis

I think it would be better if everyone acts in this role all the time actually. :) Depending of course what you mean by "code nazi". As people see code, they should be evaluating it for all the normal review criterion, regardless of whether they are actively assigned to review it at that moment.
Namespaces in PHP 6

Jan 06, 2009 · Matt Wade

If you're interested in an example Spring app, you might want to check out Examinator, a reference web app that is heavily based on the Spring frameworks (core Spring, MVC, Web Flow, Security, Transactions, DAO) as well as Hibernate and Terracotta. The app is open source and has a live demo as well as quite a bit of documentation.
Running rings around Erlang

Jan 06, 2009 · Alex Miller

Companion article: http://tech.puredanger.com/2009/01/05/scala-ring/
Running rings around Scala

Jan 06, 2009 · Alex Miller

Companion article: http://tech.puredanger.com/2009/01/01/ring-erlang/
Fibbing with Scala

Dec 31, 2008 · Alex Miller

Companion article: http://www.dzone.com/links/fibbing_with_erlang.html
Fibbing with Erlang

Dec 31, 2008 · Alex Miller

Companion article: http://www.dzone.com/links/fibbing_with_scala.html
Year in Review: What to expect in Java SE 7

Dec 16, 2008 · Alex Miller

Actually, JSR 296 is slated for inclusion. Not sure what they'll do about the dependency.
Year in Review: What to expect in Java SE 7

Dec 16, 2008 · Alex Miller

Yeah, I know. There were only a few billion changes at the last minute...didn't get them all in! So sue me...
See how your java source file is parsed

Dec 08, 2008 · Alex Miller

My apologies if I missed the original link...wasn't intentional.
Moving from Applets to Ajax

Dec 02, 2008 · Dietrich Kappe

Well, you know what they say about free advice....it's worth what you paid for it.
Moving from Applets to Ajax

Dec 02, 2008 · Dietrich Kappe

Well, you know what they say about free advice....it's worth what you paid for it.
Moving from Applets to Ajax

Dec 02, 2008 · Dietrich Kappe

Well, you know what they say about free advice....it's worth what you paid for it.
Moving from Applets to Ajax

Nov 27, 2008 · Dietrich Kappe

I see your argument. However, I realistically have almost never seen code where this actually passed more information than I was already getting from simply using good coding practices (like short methods) and other tools (Eclipse warnings, FindBugs, etc). In short, I got no benefit for a lot of noise in the code. In that sense, adding all the finals actually *hurt* the legibility of the code.
Developing with Bubbles

Nov 11, 2008 · Lowell Heddings

You're speaking my language man. This is exactly the point and focus of my talk Design Patterns Reconsidered which you can find here:

Design Patterns Reconsidered

I think if the GoF had called the book "Design Problem Patterns" that might have changed the focus a bit on identifying common problems and then discussing the many possible solutions/variations of those problems. In some cases, the problem is addressed directly in a language feature. But the problem (say the "expression problem" defined by Wadler addressed by the visitor pattern) continues to exist and need a solution, whether it's in the language or not.

Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@David: Yup. Fixed.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@David: Yup. Fixed.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@David: Yup. Fixed.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@Steven: It may be hard to see as I've only shown about 10% of the new stuff here in the file system API and haven't even touched the new asynch or multicast support in NIO. But there really are a tremendous number of new features - better API taking using of Java 5+, better security, much deeper support for platform-specific stuff, etc. I'd urge you to take a deeper look.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@Steven: It may be hard to see as I've only shown about 10% of the new stuff here in the file system API and haven't even touched the new asynch or multicast support in NIO. But there really are a tremendous number of new features - better API taking using of Java 5+, better security, much deeper support for platform-specific stuff, etc. I'd urge you to take a deeper look.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@Bernd: In general, the file operations on Path (like copyTo, moveTo, delete) now throw more descriptive subclasses of IOException, like FileAlreadyExistsException.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@Bernd: In general, the file operations on Path (like copyTo, moveTo, delete) now throw more descriptive subclasses of IOException, like FileAlreadyExistsException.
Ruby 2.0: No support for continuations or green threads

Oct 24, 2008 · admin

@Bernd: In general, the file operations on Path (like copyTo, moveTo, delete) now throw more descriptive subclasses of IOException, like FileAlreadyExistsException.
MIT’s Introduction to Algorithms Lectures

Aug 21, 2008 · Binny V A

I highly recommend the one on skip lists...
Scalable Language Design

Aug 18, 2008 · Mr B Loid

I wanted to like this post but for me it fell short of really telling me anything. Better to spend your time watching Guy Steele's classic "Growing a Language": http://video.google.com/videoplay?docid=-8860158196198824415 which will make you wish he was still at the Java helm.
The real motives why industry analysts love to predict Java fall...

Jul 26, 2008 · Mr B Loid

@Peter yes, *if* you wrote your code with volatile (which you didn't) and *if* you are using jdk 1.5+ (which many aren't) then it will work. But I think it's simpler to just say, DO NOT USE DOUBLE-CHECKED LOCKING and leave it at that. In all cases, it is less code, simpler code, equally as thread-safe, and possibly better performance to use the initialize-on-demand-holder idiom (see many references above) if you need to lazily instantiate a singleton.

Josh Bloch recommends using an enum now to hold a singleton but I don't like this in all cases. My main beef is that some singletons are written with mutable state and I think it's morally wrong :) to mutate state in an enum instance. So, if you are registering and de-registering stuff in your singleton instance, then I object to holding it in an enum. But then, I reject the use of the singleton pattern at all. :)

The real motives why industry analysts love to predict Java fall...

Jul 25, 2008 · Mr B Loid

@tranquiliser: no no no no and no. This is double-checked locking and it is NOT thread-safe. Without a memory barrier formed by synchronization on the read of instance, the instructions can be reordered and cause all sorts of thread problems. The badness that can occur will become more and more likely as we add cores. Do not do this. For more detail, read Bill Pugh's paper on why double-checked locking is broken.

The real motives why industry analysts love to predict Java fall...

Jul 25, 2008 · Mr B Loid

I wrote some more comprehensive posts on singleton (why it sucks) and double-checked locking (why it's broken and better ways to initialize singleton) that may be of interest.

As mgaravaglia noted, your third example is not thread-safe and should not be used. The Initialize-On-Demand-Holder idiom is a better (and thread-safe) way to lazily initialize a singleton.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Yep, that fixed it. Although you presized the map to 1, which probably isn't big enough. :) The default for LinkedHashMap is 16.

Also, I should mention that Terracotta provides an easy way to distribute many of these open-source caches across multiple JVMs.

Application Watch - CShout

Jul 17, 2008 · Dietrich Kappe

Your SimpleLRUCache is not LRU. The constructor needs to call the special LinkedHashMap constructor that takes a boolean arg (set to true for "last access order") instead of by insertion order. As is, this is really a Least Recently Inserted cache. Which might also be useful, but isn't LRU.
Introducing Caching for Java Applications (Part 1)

Jul 17, 2008 · Slava Imeshev

Your SimpleLRUCache is not LRU. The constructor needs to call the special LinkedHashMap constructor that takes a boolean arg (set to true for "last access order") instead of by insertion order. As is, this is really a Least Recently Inserted cache. Which might also be useful, but isn't LRU.
Modeling Opinion Flow in Humans Using Boids Algorithm & Social Network Analysis

Jul 17, 2008 · admin

@Slava My methodology was that I threw the poll up on the web, then posted about it to a few mailing lists and Twitter and my blog. Then I waited a few days. It's highly unscientific and you should probably trust it as far as you could throw me. :) I still think it's useful and interesting.
Modeling Opinion Flow in Humans Using Boids Algorithm & Social Network Analysis

Jul 16, 2008 · admin

Before Java 5, the memory model defined in the Java Language Spec in ways that were both complicated and under-constrained. In particular, volatiles had somewhat different semantics on different platforms.

Java 5 addressed that with JSR 133. You can find copious information at Bill Pugh's site:

http://www.cs.umd.edu/~pugh/java/memoryModel/

Modeling Opinion Flow in Humans Using Boids Algorithm & Social Network Analysis

Jul 16, 2008 · admin

Before Java 5, the memory model defined in the Java Language Spec in ways that were both complicated and under-constrained. In particular, volatiles had somewhat different semantics on different platforms.

Java 5 addressed that with JSR 133. You can find copious information at Bill Pugh's site:

http://www.cs.umd.edu/~pugh/java/memoryModel/

Modeling Opinion Flow in Humans Using Boids Algorithm & Social Network Analysis

Jul 16, 2008 · admin

Before Java 5, the memory model defined in the Java Language Spec in ways that were both complicated and under-constrained. In particular, volatiles had somewhat different semantics on different platforms.

Java 5 addressed that with JSR 133. You can find copious information at Bill Pugh's site:

http://www.cs.umd.edu/~pugh/java/memoryModel/

Fiddling with your privates

Jul 15, 2008 · Alex Miller

There's no comment feature on the site, but I thought it was worth mentioning that a) it is not possible to modify *final* fields in all versions of the JDK. This was originally supported, then pulled in (I think) 1.4, then added back in (I think) 1.5. b) final values are compiled into other classes compiled with that class. So you can change the value of it and other classes may still see the original value. Thus, this is *really* unlikely to work in a way you expect. Note, these apply to final fields only.
Visualize Statistics with Dynamic Cache Collector

Jun 18, 2008 · $$ANON_USER$$

Wow, those screenshots suck.
How I hacked Digg

Jun 04, 2008 · phoboslab

I will vote this up for no other reason than the comment by "Tim Berners-Lee" which made me laugh.
Web Analytics: The Results of Tabbed Browsing

Apr 30, 2008 · admin

I have a list of Java 7 related talks at Java One 2008 if that's how you roll.
Should we post our own articles on DZone?

Apr 22, 2008 · Ian Bull

Submit links you like. If you like what you write and think others would like it, then heck yeah post it. Let the votes decide what rises to the top.
Dependency Injection Without Frameworks

Apr 18, 2008 · $$ANON_USER$$

Sorry, that was: I <heart> hand-drawn UML! I also <heart> dependency injection minus frameworks.
Dependency Injection Without Frameworks

Apr 18, 2008 · $$ANON_USER$$

I > hand-drawn UML!
Test Categorization Podcast

Mar 24, 2008 · Mandy Owens

I think those are generally known as Multi-Methods and are available in a few languages. Can't say I've seen anyone even considering adding them to Java 7. Maybe you can be the first. :)

Hopefully I'll have some time soon to continue playing with this!

Google Guice Starts a New Google Age?

Mar 22, 2008 · adiian ian

+1 for Guice, -1 for this weird article
Code Golf

Mar 12, 2008 · Carl Drinkwater

Yep - I forgot that I actually started with this but wanted to avoid the instance creation.
ColdFusion Open-Source Project List

Mar 03, 2008 · remotesynth

I think you're both right that the power/complexity tradeoff is the most important thing to decide on. But I think syntax is important (but less so) because syntax affects so many things about how we perceive the feature and the language.

Stefan, I think you make an important point that less characters != better. Given two options of equal clarity and power, I'd take the one with less characters, but that kind of choice rarely occurs. More likely, clarity (and possibly power) are bound up in what those characters are. :)

Is your code ready for the next wave in commodity computing?

Mar 03, 2008 · admin

Or just use the Groovy Spring Builder. :)
Hot Dates with CSS

Feb 24, 2008 · Lebon Bon Lebon

Artur,

It sounds like you might benefit from some static or dynamic analysis tools for checking your concurrency issues. FindBugs is a great first pass to find inconsistent locking and other similar problems. Then I would use a profiling thread analyzer like JProbe, OptimizeIt, or YourKit. These tools do a pretty good job at finding data races, deadlocks, and monitor contention issues. If you haven't tried them yet, I think they'd be worth the effort.

It sounds to me like unit tests would not provide a lot of additional value so I wouldn't choose to invest my time there either. Seems like review and analysis tools are a better value.

An Approach to Internal Domain-Specific Languages in Java

Feb 19, 2008 · Kirill Grouchnikov

Great overview of the fluent interface technique
User Experience Design: If the hat fits - do you wear it?

Feb 19, 2008 · Dietrich Kappe

FindBugs also defines an annotation for nullability. But probably a better idea is to have some kind of standard annotation for this kind of thing and that idea is being worked on as JSR 305. Also tangentially related is JSR 308 which would allow annotations on a much broader set of locations in Java (in particular, on types).
Using XML in a Java Context

Feb 18, 2008 · Lebon Bon Lebon

Any chance you could link up those tools in the list?
Parsing XML file using Dom API

Feb 16, 2008 · Ahmed Hashim

I don't see any indication that this product is tied to Hibernate at all.
Parsing XML file using Dom API

Feb 16, 2008 · Ahmed Hashim

I don't see any indication that this product is tied to Hibernate at all.
Parsing XML file using Dom API

Feb 16, 2008 · Ahmed Hashim

I don't see any indication that this product is tied to Hibernate at all.
Top 12 Ruby on Rails Tutorials

Feb 13, 2008 · admin

The point of this post is really about how ReentrantLock gives you options that don't exist with synchronized blocks and methods. It's not an argument for or against the use of locks for protecting access to shared data.

In general, having one entity tell others what to do sounds to me like a prescription for low concurrency because all of the entities then have to coordinate at the central point. But it's hard to even talk about this without talking about real examples.

I don't know about you, but I lock my house, my car, etc every day. :) Lock-based access to shared state is *one* style of concurrent programming and happens to be the most prevalent in Java (for better or worse and mean argue for worse). Message-passing/actor-based or lock-free styles also exist and they all have their pros and cons.

I've written about ConcurrentSkipListMap in the past, which is an incredibly cool high-concurrency sorted map in Java 6 written with lock-free code. Lock-free data structures and algorithms rock. They're also incredibly tricky to get right (if you actually read the code for something like ConcurrentSkipListMap/Set or LinkedBlockingQueue). ReentrantLock itself is implemented with lock-free code actually.

Top 12 Ruby on Rails Tutorials

Feb 12, 2008 · admin

Yep, this is an excellent point. tryLock() and any retry strategy can avoid deadlock but does not alleviate the potential for livelock where all threads are constantly retrying and never succeeding. In that case, you don't deadlock, but make no further progress.

I believe TCP uses an exponential backoff for stuff like this (although I haven't studied this in 10 years). A fascinating topic in itself, but outside the scope of this article... :)

Top 12 Ruby on Rails Tutorials

Feb 12, 2008 · admin

Yep, this is an excellent point. tryLock() and any retry strategy can avoid deadlock but does not alleviate the potential for livelock where all threads are constantly retrying and never succeeding. In that case, you don't deadlock, but make no further progress.

I believe TCP uses an exponential backoff for stuff like this (although I haven't studied this in 10 years). A fascinating topic in itself, but outside the scope of this article... :)

Top 12 Ruby on Rails Tutorials

Feb 12, 2008 · admin

Yep, this is an excellent point. tryLock() and any retry strategy can avoid deadlock but does not alleviate the potential for livelock where all threads are constantly retrying and never succeeding. In that case, you don't deadlock, but make no further progress.

I believe TCP uses an exponential backoff for stuff like this (although I haven't studied this in 10 years). A fascinating topic in itself, but outside the scope of this article... :)

Arrays are not Iterable in Java

Feb 10, 2008 · Mr B Loid

Post-generics, I have seen some suggestions that arrays should be considered a deprecated type in Java. I'm not sure my opinion is that strong, but I think it's interesting to consider. I certainly find myself using arrays much less.
Beyond Java? It's not rails - it's agents

Feb 07, 2008 · Erik Thauvin

Hey, I somehow published this with comments off - sorry about that!

A colleague of mine just coincidentally published a blog today about using distributed CyclicBarrier with Terracotta, which is an interesting companion to the article above.

Coordinating Threads

Feb 07, 2008 · Alex Miller

Hey, I somehow published this with comments off - sorry about that!

A colleague of mine just coincidentally published a blog today about using distributed CyclicBarrier with Terracotta, which is an interesting companion to the article above.

Sun's Da Vinci Machine broadens JVM coverage

Feb 02, 2008 · Mr B Loid

I'm misquoted in this article as saying that writing in dynamic languages is complicated or obscure. What I actually said was that *implementing* dynamic languages for the JVM can be complicated or obscure due to the mismatch between the needs of the dynamic languages and the assumptions of the JVM. Oh well. Nice article otherwise though.
A new GC for Java 7

Feb 02, 2008 · Mr B Loid

I wrote the Java Zone summary and I agree with you. I'd much rather you vote for the original article in a case like this as it's way more useful than my summary. That's (hopefully) not always the case for stuff I write on the Java Zone, where I might be adding additional commentary or background, but in this case I was almost purely pointing to an excellent article that deserved more attention. ,
Is LINQ leaving Java in the dust?

Jan 30, 2008 · Mr B Loid

Yes, I am unabashedly a Java developer sharing my opinions. But I have a healthy respect for languages and platforms. I think C# is a fine language with noteworthy innovations and the CLR/DLR is a very capable platform. So I intend no disrespect for the technology. I don't see how you could conceivably say that Java is not a standard, in any useful sense of the word. There is a specification controlled by a managed process, a compatibility test, and multiple implementations passing that test. Mono withstanding, I don't think you can quite say the same for .NET. With regard to backwards compatibility, the two things I had in mind were the recent overhaul of VB and the addition of generics to C#. On VB, from what I heard changed things significantly, dramatically altering the language. For generics, I believe rather than retrofit the existing collections library, they duped it and added a generics friendly version. Neither of these is exactly "backwards compatibility" but is the kind of thing I had in mind. On generics, Java explicitly did not reify generics due to reasons like not wanting to bust or dupe the collections lib. I agree that JCP is too slow and bureaucratic and too controlled by an oligarchy of mega-corporations and that this is a problem. I still would rather have that problem than the MS-only problem.
Announcing the Panelists for ADO.NET Meetup @ Tech Ed 2006

Jan 30, 2008 · Jonathan Bruce

I grabbed it from Maven yesterday afternoon - working for me.
Announcing the Panelists for ADO.NET Meetup @ Tech Ed 2006

Jan 30, 2008 · Jonathan Bruce

I grabbed it from Maven yesterday afternoon - working for me.
Announcing the Panelists for ADO.NET Meetup @ Tech Ed 2006

Jan 30, 2008 · Jonathan Bruce

I grabbed it from Maven yesterday afternoon - working for me.
Announcing the Panelists for ADO.NET Meetup @ Tech Ed 2006

Jan 29, 2008 · Jonathan Bruce

Just in time too! I've been having all manner of problems with GROOVY-2495 under load. I switched over today and things are looking good.
Mitigating the WASC Web Security Threat Classification with Apache

Jan 29, 2008 · Lebon Bon Lebon

@gbevin, my impression is that this is basically what Bob did in ReferenceCache. I've run into scenarios where there isn't just one strategy for constructing the instances in the map and/or it is unknown at map creation time. In that case, you want to say I need this value, but if you don't have it, run this chunk of code to get it.
Ajax : Web services pose growing security risk

Jan 26, 2008 · K Devi

JSR 291 (aka OSGi R4) was approved in Aug 2007. It's not contingent on Java 7 and will work on existing JDK platforms back to, I think, Java SE 1.2. The question is really whether JSR 294 and 277 will be open enough that OSGi-based systems (which are now quite numerous) will be compatible with them. If they are not, then I fear there will be a schism in users of the two module systems with people choosing one or the other, which would be a shame.
Why I love and hate statics in Java

Jan 25, 2008 · Steven Harris

I don't like final or synchronized. And man, void just sucks.
Ajax : Web services pose growing security risk

Jan 22, 2008 · K Devi

@ng100699 (presumably Neal Gafter) - thanks for the update. I'll assume by the lack of any other corrections, that the rest is all correct. :)

@mm49838 - yep, I think ARM will get a little more fleshed out, and who knows, it may have legs regardless of which way closures go. There have been some ideas sketched out for reification and even for reconciling the collections library to work with both but to my eye it's not pretty. I'm guessing it's too much, especially on top of closures and everything else.

@aalmiray - yep, I've been doing some Groovy recently and I'm finding it very useful in thinking about what Java would be like with some of these features.

Java Version Penetration (November 2007)

Dec 06, 2007 · Jos Hirth

Up vote just for use of the word "penetration"
Using JSON to Exchange Data

Dec 06, 2007 · Louis Malenica

Up vote just for use of the word "penetration"
An Interested error in java

Nov 18, 2007 · joojoo joojooa

Actually @in86835, it's putAll(), not addAll() as Properties extends old-school Hashtable.
Coverage != testing

Nov 14, 2007 · Alex Miller

Actually, I will note that my blog has "!=" in the title and was submitted from the javascript thingie on my blog page. Hmmmmm... I emailed Rick to see if he could take a look.
Coverage != testing

Nov 14, 2007 · Alex Miller

Woohoo - if only I had some control over it.... :)
A Smooth Concurrency Revolution with Free Objects

Nov 02, 2007 · Gerd Storm

Nice review of the popular models.
Nifty Firefox search trick

Oct 25, 2007 · Alex Miller

Well, you definitely haven't had this link before as it's brand new. But it's almost certain that someone else has blogged the same tip.
JDK7: language enhancements

Oct 11, 2007 · Marcin Kowalski

Proceed directly to... http://tech.puredanger.com/java7
Parallel Computing in Java

Sep 25, 2007 · Nikita Ivanov

Apparently, he's following up with subsequent posts on how to do this with GridGain and Terracotta.
DSL renaissance

Sep 23, 2007 · Alex Miller

I consider XML-based languages to be DSLs, but then I'm willing to take a pretty wide interpretation of the term. However, I think most XML-based DSLs are fairly bad as DSLs due to their verbosity. I think either external DSLs built with tool support from language tools or embedded DSLs in general-purpose languages that have good support for them are much better options.
Caching Solutions in Java

Sep 21, 2007 · Peter Stofferis

I thought the treatment of Terracotta was kind of weird, but maybe that's expected. Terracotta actually has distributed versions of many of the caches mentioned in the article (oscache, ehcache, JCS, JBoss, etc) with excellent performance. Terracotta actually scored the second highest (over JBoss) in their spreadsheet but wasn't mentioned as a recommendation? (I work for Terracotta.)
Why SQL Server is better than Oracle?

Sep 21, 2007 · Namwar Rizvi

I have no idea (and suspect it's meaningless to say either way) whether SQL Server is "better" than Oracle. I down-voted as comparing the two based on max database size, # of security patches, a single concurrency data point, or # of job listings is meaningless. If the conclusion was that SQL Server is a viable enterprise database, I would buy that (although I can't say who would argue). But if you're going to compare them, use some meaningful basis of comparison like benchmarks, cost, ROI, ease of installation or operation, etc.
The Age of Crappy Concurrency: Erlang, Tilera, Intel, AMD, IBM, Freescale, etc...

Sep 18, 2007 · Louis Savain

This was the funniest thing I've read all day.
Java 7 Roundup (Sept 17th)

Sep 18, 2007 · Alex Miller

It just takes a well-honed system of feed readers, Google alerts, mailing lists, and personal contacts. Also, the IV drip of Diet Coke and a steady supply of donuts to keep me awake.
Scala vs. Groovy: static typing is key to performance

Sep 06, 2007 · Derek Young

As seen in the comments of the post, groovyc would make a negligible difference.
Time-Savers: Code Beautifier And Formatter

Jul 12, 2007 · Binny V A

The link annoyingly points to a particular comment on this post and not the post itself.
Java's future is mobility and usability, says Gosling

Mar 19, 2007 · Lebon Bon Lebon

The podcast is linked at the end of the article: http://computerweekly.podomatic.com/enclosure/2007-03-19T07_39_03-07_00.mp3

User has been successfully modified

Failed to modify user

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: