Archive for February, 2007

New features in JDK 6

February 26, 2007

I was planning to post this for a long time, but found the time now. I looked at the JDK 6 and some new features are very good. Though I have to really get hands-on with this version, i managed to look under the hood and come up with a concise and "usable-for-everybody" list of new things.

First thing first – This version is a great great improvement on performnace. I did not do any profiling, but our programs are starting much faster. We deploy an EAR on JBoss. JDK 5 used to take atleast 75-80 seconds on my machine to come up, but with JDK 6, its consistently below 65 seconds on the same machine. JIT has also been improved, so I think part of it is coming from there.

Other features:

1. Scripting for Java (JSR 223): Now scripting languages can be used with Java. You get best of both worlds – flexiblity of scripting languages and power of Java. JDK 6 bundles a scripting engine for JavaScript (based on Mozilla Rhino). It also supports third party scripting engines and if you go to, you can downaload and use engines for all popular scripting languages like PHP, Python, Ruby-on-Rails, AppleScript etc. The engines for XPath and XSLT are also available, though I have to see how to use them.

Scripting is good in many ways, like dynamic nature (no need of giving a datatype to a variable). Generally, a scripting language is good in doing few operations in a very efficient way, like PERL for text processing. These features can be exploited for faster implementation. Other advantage could be to integrate the legacy scripting code with new Java applications.

The new tool ‘jrunscript’ has been added to try out the things in scripting way.

2. Desktop features: There are many new features, but two are worth mentioning. One is ability to show the splash screen and other is the system tray icon. These two features are very useful and the overall experience of Java application will be more like a native application. The other thing is, everybody was doing it anyway in their own way. Now its not required as Java is here to help you out.

3. I/O: Two new good features. A new class ‘Console’ is added. It provides support for reading the passwords from console without displaying them.

Other is, in the File class new utility methods have been added for getting the total space on the disk, total free space on the disk and total usable space on the disk.

4. Networking: In JDK 6, cross platform NTLM is supported. It also comes with a default Cookie Manager. However, the biggest is that now JDK 6 gives you all required classes for creating a light-weight HTTP server. In fact, it also comes with a default implementation.

5. Monitoring and Management: Its very easy to find the deadlocked threads now using ‘findDeadlockedThreads’ method in ‘ThreadMXBean’. This could be very useful in error handling specially for enterprise applications. The error handler can restart the application when it detects the deadlock.

New classes and methods have been added to get a list of locks owned by a thread and also to find which stack holds the lock for a monitor. Another method that can help in desiging better application experience is ‘getSystemLoadAveage’. Apart from cosmetic value, this can be used to take certain runtime housekeeping opeartions.

I have to see what will be the performance penalty on using these methods. From the name of it, they look pretty expensive.

JMX has been upgraded to JMX 1.4 in JDK 6. JConsole, the swing based JMX client is now officially supported. It doesn’t work with JBoss though as JBoss comes with its own JMX implementation.

It is facinating to see how Java has transformed itself into JMX-aware machine. Most of the thing are controllable/viewable through JConcole.

6. Tools Package: A new package (*) is given for using the Java tools in programmatically. The most useful one, I guess is JavaCompiler. It allows you to invoke the compiler programatically in a standard way.

7. Others:

a. Profiles and debuggers can now attach to running VM. The VM doesn’t need to be started in a debugging-capable mode. This will be a huge help in the diagnosis.

b. RMI calls can be made over SSL.

c. Few new Collection interfaces are added.

d. JAR tool will maintain the timestamps of the files while extracting them.

e. JAXB has become part of JDK 6. ‘xjc’ tool also comes with JDK now to generate the binding classes. However, there is no compatible ANT task (so far), so you will have to use ‘exec’ in the build scripts for using ‘xjc’

f. DerbyDB (formerly Cloudscape) is bundled with JDK. This can be used for DB operations in the development time.

I will post my experiments with this release in the coming days.


Trips to NITs for campus hiring

February 26, 2007

This year I participated in my company’s campus hiring program and as part of that I visited three campuses. I had always¬†wanted to go for campus hiring and this year I got my chance. The campuses I visited are, NIT Warangal (near Hydrabad), NIT Suratkhal (near Mangalore) and Guindy College of Engineering, Chennai. It was a mixed experience, but one thing was common that the new crop is not so serious about programming. Some of the candidates were very good in data structures and other theoratical concepts, but in programming just average!

I got to know lot many other things and it was really fun to be there. The NITs, or National Institute of Technology are known as RECs or Regional Engineering Colleges earlier. Professor Venugopalan at NIT Warangal told me interesting history behind all this name change and all. In REC days, these colleges were goverened by State Governments and were in a pathetic conditions. It was evident from the look of NIT Warangal campus. It was looking like that building have never been painted or repaired ever since they were built, somewhere in 1950s. I was just taking a walk and passed through a building which looked like locked to me. When I got closer I realized that it was Deptt. of Electrical Engineering ūüôā

Dr. Murli Manohar Joshi (in NDA era)¬†gave this idea of making RECs as NITs. As part of this transformation, NITs would become autonomus bodies, just like IITs and will be funded by Centre. It was a good concept. As part of the execution, 12 directors were appointed for the first 12 converted NITs. But in our country, everything is politically driven. In the present government, Mr Arjun Singh (yes, the same reservation guy) didn’t like the idea. He threw out all the directors, and now most of the NITs are running without a director. Now, most of the colleges have funds but no person to lead the effort in making NITs as world class institutes like IIT.

I was most impressed by Professor Venugopalan at NIT Warangal. He organized the overall hiring program in an exceptional¬†way. Deptt of Placement was very good and it displayed all the numbers. I was awed to see that last year NIT Warangal has generated as many as 708 offers. All the B.E./B.Tech. students got placed and only few M.Tech. student didn’t get the placement. This year, the story is even better. All the top companies were visiting the campus.

While arrangements were really cool at Warangal, it was opposite in NIT Suratkhal. Actually, it was opposite in many ways. The campus is nice. In fact, this is the only college in India which has its own private beach!!!¬†¬†No kidding. This campus is 20 KMs from Mangalore. The road between Mangalore and Suratkhal is hell and it took us more than an hour to reach there. The students were nice, but placement coordinator was keen on talking about himself rather than students. No planning, no arrangements, nothing. While I was giving presentation, another company arrived and I was asked to finish early!!! I liked Mangalore as city and I think state govt. should put more efforts in developing it as big city. Infosys has a centre there. Mangalore, though small, is a very advanced town.¬†At least two¬†nationalized banks (Canara Bank and¬†Corporation Bank) started from there. Karnatka Bank also started from there. This city has given lots of hoteliers as well. The beach was nice and I had lot of fun there. The city has lots of Ice Cream parlours and ‘Gadbad’ is famous ice cream from Ideal Icecream Parlour. Another famous thing I couldn’t try is Golli Bajji. I hope I will try it next year.

Chennai was no-event kind of experience.  

Overall, it was a nice experience and a good way to learn about the history and geaography of places. I am hoping that next year I will be visiting to new places.