站内搜索: 请输入搜索关键词

当前页面: 开发资料首页J2SE 专题Five Reasons to Move to the J2SE 5 Platform

Five Reasons to Move to the J2SE 5 Platform

摘要: Five Reasons to Move to the J2SE 5 Platform
<table cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td class=smaller vAlign=top>By Calvin Austin, January 4, 2005 </td> <td width=10> </td> <td vAlign=bottom align=right> <table cellSpacing=0 cellPadding=0 border=0> <tr> <td valign="bottom" align="right"></td> <td valign="bottom" class="smaller" nowrap="nowrap">E-mail</td> <td> </td> <td valign="bottom" align="right"> </td> <td valign="bottom" class="smaller" nowrap="nowrap">Print-friendly Version</td> <td> </td> <td valign="bottom" align="right"></td> <td valign="bottom" class="smaller" nowrap="nowrap">Download</td> </tr></table></td></tr></table> <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table>

This article provides five important reasons to move to the Java 2 Platform, Standard Edition (J2SE platform) 5.0. Each reason is supported by data and references to prove that the 5.0 release will reduce development and runtime costs.

J2SE 5.0 (codenamed Project Tiger) was released at the end of September 2004. It is one of the most significant updates to the Java platform in many years. The Java community has eagerly welcomed its new features, yet these new features are not what makes the release special. What does? The platform was subjected to a higher level of testing than any previous version, to prepare it for mission-critical production.

Given the wealth of improvements in J2SE 5.0, choosing the top five reasons for this article was a tough task. My choices follow.

#1: Your application already works on 5.0 <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table>
<table cellSpacing=0 cellPadding=0 width=200 align=left border=0> <tr> <td class=dkgrey1> <table cellSpacing=1 cellPadding=0 width="100%" border=0> <tr> <td class=navblue> "To ensure this high level of backward compatibility, the number of compatibility tests was doubled..."


Calvin Austin
Sun Microsystems

</td></tr></table></td> <td width=7></td></tr></table>

You don't need to redesign or recompile your application to take advantage of J2SE 5.0. Not only is your investment in existing applications protected but you actually benefit from running your application on a newer Java runtime.

To ensure this high level of backward compatibility, the number of compatibility tests was doubled from 1.4. These compatibility tests are part of a Java test suite that contains nearly 200,000 tests and includes testing many well-known Java applications.

So your application runs unmodified. What does J2SE 5.0 offer then?

Improved Performance

The performance of both client and server applications have been significantly improved in J2SE 5.0. As the improvement in performance has been so impressive, I've made it Reason #2. More on this in the following section of this article.

Monitoring and Manageability

J2SE 5.0 brings an advanced monitoring and manageability framework built into the Virtual Machine for the Java platform (Java Virtual Machine or JVM). [Note: The terms Java Virtual Machine and JVM mean a Virtual Machine for the Java platform.] You can use your existing management consoles with industry-standard JMX and SNMP protocols to monitor a JVM and even detect low memory conditions. The JDK release provides a demo, called JConsole. It lets you evaluate the benefits in monitoring the JVM and see how you can exceed your availability metrics.

New Look and Feel

The Java platform already contains a pluggable Look-and-Feel framework. The addition of the new Ocean Look-and-Feel enables cross-platform applications to switch between Ocean or the native operating system's look-and-feel, without the need to rebuild or recompile them.

#2: It is faster <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table>

A number of factors play into J2SE 5.0's improved speed, illustrated in the following figure.

<table cellSpacing=0 cellPadding=2 width=347 align=right border=0> <tr> <td class=grey3 width=5></td> <td class=dkgrey1> <table cellSpacing=1 cellPadding=0 width="100%" border=0> <tr> <td class=navblue>

</td></tr></table></td></tr></table>
Reduced startup time

If you haven't started a desktop Java application in the last few years, you may be in for a pleasant surprise. The introduction of class data sharing (in combination with other streamlining options) has shaved nearly 30 percent off the startup time for some applications.

Great 64–bit performance

The J2SE 5.0 64-bit JVM delivered record results with the AMD64/Opteron CPU and Suse Linux Enterprise Edition 8.0 SLES 8.0. In addition, the 32-bit version of the JRE can run side by side under the same 64-bit OS for use with existing 32-bit web browsers.

Performance ergonomics

The JVM is now self-configuring and self-tuning on server-class machines. A server-class machine is a machine with two or more CPUs and at least 2 GB of memory. The server-based performance ergonomics kicks in by rightsizing both the memory required and the class of optimizations needed for longer lived applications. This has resulted in an 80 percent improvement on one application server benchmark without changing a line of code or supplying any runtime options!

#3: Reduced development time <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table>

Integrated development environments (IDEs) have tried to make developers' lives a little easier with auto-completion and wizards for common tasks. J2SE 5.0's new language features further streamline development, whether you use an IDE or handcode in a text editor.

Reduced need for developer coding

Many of the Java language changes reduce the amount of code a developer has to write. The following figure quantifies that reduction, in comparison to J2SE 1.4.2. To take a real life example, one open source application server uses over over 2,000 Iterators. By substituting the new enhanced for loop, the code would be reduced by up to 40,000 characters. To a developer, that is a saving of at least two hours of solid coding (5 characters a second).

<table cellSpacing=0 cellPadding=2 width=521 border=0> <tr> <td class=grey3 align=middle> Figure 2: Reduced Coding Effort (Fewer Lines of Code).</td></tr></table>

The addition of metadata into the platform provides the greatest scope for reduced development time through the use of tools that can generate boilerplate code and configuration information. In the case of SOA and web services, as defined in JSR 181, developers should expect to see over a 50 percent reduction in code by auto-generating common code. [Note: The preceding figure shows a metadata JAX-RPC example from 209 to 95 characters, Enhanced for loop using generics 139 to 100 characters, non-generic enhanced for loop for each 121 to 90, to/from autoboxing 69 to 56 characters.

Metadata will reduce the amount of effort required for deployment descriptors. One proposal for EJB 3.0 removes the need for any deployment descriptors by default by generating the configuration information from the application itself.

Improved Error Checking Savings

A google search using the terms "ClassCastException" and "help" generated nearly 40,000 hits. A more focused search on the Sun forums reported 3,444 cases of developers asking for help to track down unexplained runtime failures due to class cast exception issues.

Out of those 3,444 cases, over 470 involved the pre-generics vector class. In terms of return on investment, any runtime error can cost on order of 10 percent of a company's website revenue at peak periods (300m GBP on revenue of 3Billion GBP). That doesn't even begin to factor in the additional cost to personnel and goodwill.

The introduction of compile-time typesafe generic types to the Java platform reduces the risk of runtime errors by alerting developers at development time if there is a type-matching problem. In the case of the 470 forum postings, the Vector and other key libraries in the JDK have been updated to use generics in J2SE 5.0 and will prevent a repeat of those unexplained runtime issues.

#4: Ready for Mission-Critical Systems <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table>

The 5.0 release offers enhanced scalability, quality, and deployment support.

Scalability

The Java platform was designed with scalability for both client and server machines. The 5.0 release introduces a powerful concurrency library that makes multi-threaded programming even easier and more powerful than before. The Java platform also provides support for both 64-bit and also multi-core and hyper-threaded chip technologies. The 64-bit JVM allows applications to use more than 4 GB of heap space and to integrate with other 64-bit applications. (reference 8)

Quality

The J2SE 5.0 platforms has completed a comprehensive set of burn-in tests on a large set of systems and OS variants. The tests involved many popular application servers and client applications. The last metric taken—the Mean Time To Failure stress test—ran to completion without any failures.

Deployment

Prior to J2SE 5.0, it wasn't easy to determine the utilization or transaction throughput of a production JVM. The new profiling tools and self-tuning features provide better production right-sizing information and configuration. These features reduce the scope for surprises when the application goes live.

To complete the deployment picture, as highlighted previously in reason number 1, the JVM can now be fully monitored remotely using industry-standard tools. This enables system administrators to successfully manage JVMs either in a cluster or in a traditional vertical scaling environment. Both the health and utilization of your deployed applications can be monitored.

To cap off the four technical reasons for upgrading, there is one final, important reason to move to 5.0.

#5: You Are in Good Company <table class=grey4 cellSpacing=0 cellPadding=0 width="100%" border=0> <tr> <td></td></tr></table> <table cellSpacing=0 cellPadding=0 width=250 align=right border=0> <tr> <td width=5></td> <td class=dkgrey1> <table cellSpacing=1 cellPadding=0 width="100%" border=0> <tr> <td class=grey3> Books based on J2SE 5.0

- Java 5.0 Tiger: A Developer's Notebook. David Flanagan, Brett McLaughlin. O'Reilly & Associates, 2004.

- Java 2 v5.0 (Tiger) New Features. Herbert Schildt. McGraw-Hill Osborne Media, 2004.

- Beginning Java 2, JDK 5 Edition. Ivor Horton. Wiley, 2004.

- Core Java 2, Volume I, II (7th Ed.). Cay Horstmann, Gary Cornell. Pearson Prentice Hall, 2005.

- Just Java 2 (6th Ed.). Peter van der Linden. Prentice Hall, 2004.

- An Introduction to Programming and Object-Oriented Design Using Java 2, 2nd Ed. Jaime Niño, Frederick A. Hosch. Wiley 2005

- The Java Class Libraries Poster : Java 2 Platform Standard Edition 5.0 (8th Ed.). Patrick Chan, Rosanna Lee. Addison-Wesley Professional, 2005.

- Objects, Abstraction, Data Structures and Design Using Java Version 5.0. Elliot Koffman, Paul Wolfgang. Wiley, 2004.

</td></tr></table></td></tr></table>

The Java Community stands behind the improvements in J2SE 5.0. The J2SE 5.0 expert group comprised the following who's who of the Java industry: Apache, Apple, BEA Systems, Borland, Cisco Systems, Fujitsu, Hewlett-Packard, IBM, Macromedia, Nokia, Oracle, SAP, SAS Institute, SavaJe Technologies, Sun Microsystems, John Zukowski, Osvaldo Doederlein, and Juergen Kreileder.

There were 16 working groups, composed of well-known experts in the Java field. They formed a worldwide group of 160 experts collaborating on the J2SE 5.0 Java Specifications. The specifications covered everything from language updates to concurrency libraries to a class file-compression API. For more technical details, see J2SE 5.0 in a Nutshell. And the growing number of books in the sidebar on this page.

In addition to the Java expert input, the community at large has taken notice. There have been over one million downloads to date!

Summary <table class=grey4 cellSpacing=0 cellPadding=0 width="67%" border=0> <tr> <td></td></tr></table>

This article listed my top five reasons for moving to the Java 2 Platform, Standard Edition (J2SE platform) 5.0. (The article does not cover the full range of client- or server-side features.) Everything about the platform—from the specifications to the source code, which is licensed under the SCSL and Java Research Library—is available so that you can make your own decision. Contact us through our community forums to let us know what you like about the release.

See Also <table class=grey4 cellSpacing=0 cellPadding=0 width="67%" border=0> <tr> <td></td></tr></table>

The following tools and applications take advantage of the J2SE 5.0 enhancements, to make developers more productive:

- New J2SE 5.0 Enhanced tools and applications
- Java System Application Server 9
- NetBeans 4.0
- Eclipse 3.x
- Borland JBuilder 2005 - Wily Introscope



↑返回目录
前一篇: 谈谈J2SE中的序列化
后一篇: 学习J2SE过程中的30个基本概念