Developer/Designer Notes

Archive for the ‘java’ Category

DWR Web Application is hanging

Posted by Kiran Mova on May 3, 2007

Not really. But that was the symptom. I am using DWR in my project for all my client server interactions. After a while, the DWR Post requests from the client are not serviced by my server.

The first thought was to check if there was any case of a dead lock, since I am using Java synchronized keyword to control access of shared data structures. With that out of the way, it seemed like I had hit a road block. Can DWR be hanging? (Tried googling it.. I have come to believe that if the problem is not reported by google, the chances are that no one ever faced that issue. The only bottleneck is to have the right keywords.)

Anyways, coming back to my issue my colleague noticed that, application was hanging only when it was executed from the Netbeans IDE. That seemed very very odd, but it meant the only way to find out was to use the Netbeans Debugger.. As it turns out, I should have first tried with the debugger before code walk-through. I gue

After a little fiddling around, we noticed that there were 25 http threads and a couple of them seemed to have stopped. They were stopped on the unsuspecting – “System.out” and “System.err”. (Or it is obvious…. )

So this time I googled for “netbeans system.out hangs”. To uncover the Netbeans bug – 4903180

Advertisements

Posted in html, java, javascript | Leave a Comment »

Java Using new forloop with Hashtable..

Posted by Kiran Mova on April 5, 2007

How simpler can it get? In the past I always dreaded writing the iterators/enumeration code to loop over the values in a Hashtable. With new for loop syntax in Java 5, I love it!

Hashtable<String, String> myHashtable;

// Creation and initialization code…

//When I want to itereate through values:
for (String val : myHashtable.values() ) {
//do something with val…
}

Like always, there are limitations/nuances to using the new for loop. The following links help understand this java 5 for loop concept better:

Posted in coding, java | 2 Comments »