Java technology, IBM style: a new era of Java technology (New Features of Java 7)

Source: Internet
Author: User
Tags new set
Java technology, IBM style: a new era of Java Technology

Key Points of Oracle specifications and IBM's performance, reliability, and value-added services

Chris Bailey, Java support architect, IBM

Chris Bailey joined IBM Java technology centre in 2000 as a graduate of southamton University. He is a technical architect of the IBM Java service and support organization and is responsible for helping ibm sdk for Java users to provide successful application deployment. Chris's work also includes collecting and evaluating emerging needs, delivering a variety of the latest debugging functions and tools, improving documentation and improving the quality of ibm sdk for Java.

 

Introduction:The much-anticipated final version of Java SE 7 is expected to include enhancements to all aspects of the language and virtual machine. Oracle and IBM have released their own early access downloads for evaluation and feedback. In this article, Chris Bailey, strategic architect of Java services at the IBM Java technical center, will introduce some changes in the Library, including Oracle specifications and value-added services provided by IBM.

It is expected that the latest version of the Java platform will be released in the fall of this year will be significant and highly anticipated. Although Java specification request (JSR) has not been formally created on the Java 7 platform through Java Community process (JCP), and the final feature set is still unknown, the early access download launched by Oracle (see references) the Oracle team's public statement provides some help for us to understand the content of Java SE 7.

Expected features are divided into the following four categories:

  • Non-Java support
  • "Easy to develop" Updates
  • Modular support
  • Scalability update

Non-Java support and JSR 292

Java 7 will provide some enhancements that allow compiler implementations in Dynamic Language to generate implementations more easily for Java runtime and allow these implementations to run with higher performance. JSR 292 is the driving force of changes. It introduces new bytecode and a series of new Java classes.

In most cases, the Java language is strongly typed, which requires specifying the parameter type passed or returned in the method. However, at the byte level, Java is more inclined to the weak type: the variables in the operand stack only need to specify the type when they belong to the relevant primitive type or are generally referenced by the object. In almost all cases, the byte level uses a weak type. A method call is an exception. It enforces a strong type-that is, it uses its complete signature when calling a method, including parameters and return types. In this case, the Java method needs to be called using the known Java type. This can cause problems with dynamic languages, such as Ruby, Python, and groovy, because they are dynamic types (the types are only known at runtime ).

Some mechanisms can be used (usually based on reflection or using generated calling programs) to avoid these problems and allow dynamic language running on JVM, but they are significantly affected by performance. The introduction of JSR 292 aims to solve these problems by adding a new Java bytecode invokedynamic to call a dynamic method and using the Java language association mechanism to Process Method structures that can be rewritten at runtime.

"Easy to develop" Features

Similar to previous releases of the Java platform, many new language features help simplify the syntax required for common structures.

Project coin

Project coin covers many small changes (coins). It aims to reduce the complexity of writing simple tasks and improve the readability of generated code.

  • switchStatementString
    In versions earlier than Java 7switchStatementStringOrObject. This means thatStringRunswitchThe only method of statements is to use a seriesif-then-elseStatement orStringConvert to the original type orenumType.StringInswitchThe usage in the statement means that the following simple structure is valid now:

    switch (myString) {               case "one": <do something>; break;               case "red": <do something else>; break;               Default: <do something generic>;}
  • Improves type inference for creating generic instances
    Java 5 introduces generics, which enables it to apply parameterized types to General Collection classes during instantiation, so as to implement security check during compilation. However, in implementation, type parameters may be unnecessary, for example:
    Map<String, List<String>> anagrams = new HashMap<String,List<String>>();

    The modified type setting allows the second <> structure to be inferred:

    Map<String, List<String>> anagrams = new HashMap<();
  • SimplifiedvarargsMethod call
    Currently, when you call a method that accepts variable length parameters, the call code receives a warning during compilation, prompting you to perform unsafe operations. With this new feature, the warning will be moved to the method declaration that accepts variable length parameters, thus reducing the number of unavoidable warnings in the call code.
  • Language Support for collections
    You can specify an array that uses the following syntax to initialize the array:
    int[] array = new int[] {0,1,2,3,4,5}

    This syntax applies to collections now, for example:

    List<String> numbers = ["one", "two", "three", "four","five"];
  • Automatic Resource Management
    This enhancement provides a newtryStatement to declare one or more resources that must be manually disabled. For example,InputStreamOrOutputStream. Brand newtrySyntax means that after the statement is completed, the declared resources are automatically disabled:
    static String readFromFile (String file) throws IOException {            try (BufferedReader reader = new BufferedReader(new FileReader(file)) {                           return reader.readLine();            } // resources are automatically closed here}
Closure debate

Closures have aroused considerable controversy in the Java Community. Include or discard? What is the best choice? As early as 2007, Brian Goetz had a discussion of the closure at that time, and this had gradually declined over time. Neal gafter always supports adding closures to the Java language. The Java closure page provides a lot of information about this topic.

Closure (non-coin)

Many programming languages, including scheme, Ruby, and smalltalk, allow the use of closures or Lambda functions. Closure implementation is expected to be added to the final Java 7 Specification; however, the detailed implementation is not clear because there are several competitive proposals.

 

Disruptive support

In each new version of Java platform, the size of the SDK increases-this side effect is caused by the increase in available functions in various environments. Although many functions are resources, the huge volume and complexity will inevitably affect some key performance indicators: Download size, startup time, and memory usage.

Project jigsaw

Access {
Linkqueryappend (this)
} "Href =" http://www.ibm.com/developerworks/java/library/j-javaroundtable/index.html "> developerworks Roundtable, learn about Project jigsaw and its location in a Java disruptive solution. This includes the latest information about Java technology, culture, and industry.

To solve these problems, Java 7 plans to provide a modular JDK runtime, that is, project jigsaw. It will allow users to download and load only the components required to run the application. In addition, users will be able to apply modularity to libraries and applications. The final implementation is not yet determined.

Scalability update

With the increasing popularity of multi-core systems and the increasing number of kernels in these systems, the development of Java language to scalability is also the trend of the times. Expansion refers to the Scalable collection, data structure, and algorithms that developers need to access. Java continues to improve scalability in version 7, mainly reflected in two features: brand new I/O 2 and concurrency and collections updates.

Brand new I/O 2

The Java platform 1.4 release introduces a new set of I/O (NIO) apis under JSR 51 to allow highly scalable I/O development, you do not need to develop local code. JSR 51 focuses on Buffering and channels, and provides non-blocking multiplexing I/O. In version 7, we added (new) New I/O API (nio.2) under JSR 203 to further expand the work we started in version 1.4.

Nio.2 API covers three major enhancement areas: asynchronous I/O, updated socketchannel functions, and stronger file system interfaces. These updates will continue to provide the ability to generate highly scalable I/O infrastructure.

  • Asynchronous I/O
    Java platform version 7 introduces Asynchronous I/O for sockets and files: it provides a new setAsynchronousChannelTo allow the thread to continue working. At the same time, I/O will continue and I/O will be notified later. Version 7 provides two notification mechanisms: first, asynchronous I/O calls will returnjava.util.concurrent.FutureObject, which indicates the generated object. It is used to provide an API to wait for the I/O to complete or to poll its current state. The second mechanism is to specifyjava.nio.channels.CompletionHandlerThis will be called in the callback when I/O is complete.
  • Updated socketchannel API
    Before nio.2 updates the socketchannel API, network channel implementation is not a complete abstraction of network sockets: You need to use sockets and channel APIs to create network channels. Updates solve this problem, and each network-oriented channel will implement a newNetworkChannelInterface, which definesbind(),getLocalAddress(),getOption()AndsetOption()Method. In addition, the newMulticastChannelAdded support for multicast.
  • Improved File System APIs
    The improved file system API fixes some basic problems in the standard Java file I/o api (for example, an I/O exception occurs when the file is deleted or renamed ), it also provides new support for common tasks that require custom code execution on the provided APIs. This includes support for copying and moving files, symbols, links, and file permissions, and provides a file change notification and monitoring API.

Concurrency and collections updates

Java 5 introduced in JSR 166java.util.concurrentJava 6 is further extended through JSR 166x. Then, Java 7 updated the concurrency through JSR 166y and provided a new fork-join framework, namely the multi-core friendly lightweight parallel framework in Doug Lea, director of JSR ". Other enhancements includeTransferQueueAndPhaser.

Stick to fork

The long-awaited strong evidence of Java 7 is that the popular two-part series of articles on the fork-join framework written by Brian Goetz was published almost two years ago. Part 1 introduces the decomposition of many algorithms to effectively utilize the mechanism of hardware concurrency, and Part 2 is discussed in detail.ParallelArrayClass, which simplifies the concurrent sorting and search operations on the data structure in the memory.

  • Fork-join framework
    The purpose of the fork-join framework is to provide support for high-performance computing tasks that can be divided into multiple parallel tasks, allowing effective use of multiple processors and kernels.

    A typical example shows that the Merge Sorting Algorithm can be divided into multiple concurrent tasks. The data to be sorted is decomposed into segments that can be used as separate sub-tasks, and sub-tasks may be further decomposed into smaller sub-tasks. After the sub-task is completed, integrate the results (merge ). The process is to break down a specific task into multiple sub-tasks and wait for the tasks to be merged. The fork-join framework added in Java 7 provides the infrastructure for Fork-Join Processing, including pool processing and job theft, to reduce the impact of waiting for other subtasks to complete.

  • Transferqueue
    TransferQueueYesBlockingQueueBut the difference is that it provides a recorded delivery service. After the object is successfully added to the queue, an insert object is returned.BlockingQueueBut only after the other thread deletes the object from the queue will the system returnTransferQueue.
  • Phaser
    PhaserClass provides a brand new synchronous blocking object, which is introduced in Java 5CyclicBarrierSimilar, but provides some additional features. In particular, the ability to dynamically change the number of registrants.

Value-added features provided by IBM

In addition to the mandatory update features of each new Java platform release (due to JVM specifications and Java class library API updates), each Java vendor allows it to deliver its own value-added features to its Java feature package. For IBM's Java feature packages, these value-added enhancements are generally targeted at three areas: performance, reliability, and service.

Understand IBM Java SE 7 Implementation

The performance during Java Runtime is a direct factor affecting the ROI of deployed applications. In view of this, various standard benchmark tests can be used to simulate specific deployment scenarios or workload types to give a general understanding of ROI. While most benchmarking tests focus on runtime performance-the speed at which applications can execute-IBM is also very interested in the initial startup time of the application.

Learn more about IBM's participation in Java SE 7

IBM's Java SE 7 Chief Architect Trent gray-Donald here {
Linkqueryappend (this)
} "Href =" http://www.ibm.com/developerworks/podcast/dwi/cm-int041910-java7.mp3 "> podcast provides his insights on Oracle Java 7 specifications, IBM value-added features, and the level of Java technology development.

Startup Performance
The Startup Performance of Java applications is a major concern of the IBM team, not only because the startup time may affect the applicability of client applications, it also affects the reuse of server applications and the start time of failover scenarios.

In ibm sdk for Java 5, IBM provides a major feature to reduce the Java application startup and restart time in the form of class sharing. This method allows all System and Application classes to be stored in the persistent dynamic class cache of the shared memory and is in a State that has passed the class data verification (important ). The result is that when a Java application loads a class, a large number of operations occur at startup, while the shared memory does not validate the bytecode overhead.

In ibm sdk for Java 6, IBM continues to add moderately optimized just-in-time (JIT) Compilation code to the shared class cache for Startup Performance. This means that another major overhead of the startup process can be eliminated: Compilation of common methods involved in the application startup process.

The ibm sdk for Java 7 will further improve Startup Performance, focusing on storing more data in the shared cache and executing single-thread startup activities on multiple threads.

Runtime Performance
The performance of Java applications is always the focus of most vendors. Similarly, IBM's Java runtime has a priority field. Each IBM runtime release strives to enhance the performance of the previous release.

Table 1 shows performance enhancements between ibm sdk for Java versions 5 and 6 (using IBM 32-bit Java Runtime on AIX ):

Table 1. Performance Table of ibm sdk for Java

Ibm sdk for Java Result (BOPS/JVM)
4-core
Result (BOPS/JVM)
8-core
Result (BOPS/JVM)
16 cores
V5 87737 86686 86497
V6 102959 100731 99844
 
Percentage Enhancement 17.3% 16.2% 15.4%

Note:: Data comes from spec jbb2005 benchmark data released on spec.org, which uses IBM Java Runtime on IBM system p 570 and 4.7 GHz.

For ibm sdk for Java 7, the runtime performance is still very important. {
Linkqueryappend (this)
} "Href =" http://www.ibm.com/developerworks/java/jdk/beta/index.html "> the Open Beta project page will detail the latest features.

Reliability

The reliability of Java Runtime is extremely important, which is particularly prominent when running business-critical applications on a 24x7 basis. To create highly reliable runtime, the IBM team adopted a large number of quality processes during development and used code library structures and testing strategies to maximize test scopes and scenarios.

Public code for all platforms
Since the release of the ibm sdk for Java 5, all the underlying components implemented during IBM Java runtime have been built on a public code base, and there is little platform or architecture-related code. IBM has delivered 14 IBM sdks for Java 6 releases covering 31, 32, and 64-bit windows and Z/OS on the mainframe. Extensive hardware and operating system configurations allow testing to ensure reliability in a large number of scenarios. Through expansion, finding and fixing errors in a configuration result can improve all configurations. This wide range of testing scenarios will greatly improve the likelihood of timing and synchronous errors.

Help shape ibm sdk for Java 7

{
Linkqueryappend (this)
} "Href =" http://www.ibm.com/developerworks/java/jdk/beta/index.html "> Open Beta offers licensed access to the latest ibm sdk for Java 7 beta. It provides a preview of new technologies and features, and allows you to provide feedback through open beta project discussions.

Product portfolio
Most IBM software group products use Java code. This means that IBM is not only interested in creating high-quality and reliable Java runtime, it will also perform a large number of tests on the IBM software product line. Testing scenarios (including testing open-source products) for Java runtime will be combined to test a large number of typical deployment and load scenarios for these IBM software products. This test breadth and depth helps ensure the quality and reliability of IBM Java runtime. In addition to the IBM software group portfolio, many isV partners will also test various software scenarios for IBM runtime to further extend the use case coverage.

Service Availability

Like all vendors, IBM strives to deploy applications perfectly, but an accepted fact of software development is hard to avoid defects that may lead to unexpected results. To understand the root cause of the problem and solve it, IBM provides monitoring and diagnostic functions and tools to help eliminate problems during Java application deployment or Java runtime.

Debugging Functions

  • Dump engine Enhancement
    The dump engine allows you to generate different types of data, from non-destructive system dump to thread dump, or even select to execute specific command lines and perform this operation in a wider range of event conditions.

    With the help of ibm sdk for Java 7, you can now generate a new dump type, including the "stack" type, which can generate a single stack trace for the thread that causes the event, it also applies to more events, including "Allocation" events that occur when objects are allocated.

  • Trail engine Enhancement
    The tracing engine can trace the internal status of Java code and the status of the Java code running on the Java runtime without detection, including the core class library, middleware code, or your own code. In addition to executing the engine trace code, you can also trigger events. At the most basic level, you can use the toggle to enable or disable a trail to reduce the amount of data generated for the trail and generate a dump, including the newjstracktraceDump, which provides Call Code stack tracking and a "Sleep" option that can be used to insert arbitrary latency into the Running code.
  • Java dump Enhancement
    The javadump file contains a summary of the running state, including stack tracing for all threads in the application. The file is also enhanced. Changes take the form of operating system unlimitedly (ulimits) and environment variables, as well as local (c) stack tracking of various threads, so as to better understand the behavior of table Java code in the Java runtime era, or any event in Java Native Interface (JNI) code.
  • Diagnostic collector
    When General protection fails orOutOfMemoryErrorWhen a problem event occurs, a large number of diagnostic files are generated during the IBM Java runtime, including useful information about the root cause of the problem. The diagnostic collector tool runs after the diagnostic file is created. It searches for system dump, Java dump, heap dump, Java trace dump, and detailed GC logs to obtain the timestamp related to the problem. Then, the diagnosis collector generates a compressed. ZIP file, which contains all diagnostics of the problem event to reduce the disk capacity occupied and eliminate the need to manually search for files that may or do not exist.

IBM monitoring and diagnostic tools

  • Garbage collection and memory visualizer (GMV)
    Ggmm provides applicationsverbose:gcOutputs or analyzes and views the memory monitoring data of the operating system, and displays the data in graphs and tables. It also provides a clear summary, explains information to generate a series of tuning recommendations, and detects Java memory leaks. This interpretation allows you to understand the application's memory usage configuration file and improve the performance of the garbage collector through tuning.
  • Dump analyzer
    The dump analyzer tool helps you use the OS dump to identify the root cause of a Java application failure. It provides independent analyzer to generate specific data to answer specific questions. Together, these analyzers Generate Reports on any problem source and application status.
  • Health Center
    Health Center is a low-cost real-time monitoring solution that allows you to get the current status of running Java applications. The health center provides information about performance, memory usage, management, optimization, and analysis in an easy-to-understand manner. In particular, the health center provides method analysis information, which can reflect the call frequency and call stack trace of methods, and provide information about Synchronous Code in applications, and data about memory usage of Java heap and overall process.
  • Memory Analyzer
    Eclipse mat is extended by using diagnostic tool framework for Java (dtfj), and memory analyzer (memory analyzer) introduces the diagnostic function of eclipse memory analyzer tool (MAT) into IBM Java runtime. This extension allows Java heap analysis to use the OS dump and IBM portable heap dumps (PhD), so that you can diagnose the root cause of Memory leakage and analyze the memory usage of applications, check the Java collections size and efficiency, and understand the status of the application at a specific time.

Conclusion

Oracle and IBM are developing Java 7 sdks in an orderly manner. Although the specifications and content of the release are constantly changing, the information in this article should help you better understand the current situation. You can also track development progress through the early Access Project (see references) to help you integrate the development process and get feedback on important features and functions.

References

Learning

  • {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/podcast/dwi/cm-int041910-java7.mp3 "> IBM's head architect for Java SE 7: In this podcast, Trent gray-Donald talked about the Java SE 7 specification, IBM's thoughts on the enhanced platform, and his insights on today's Java technology.
  • Pure danger TECH: Java 7: Alex Miller lists the proposed features of Java 7 and related information.
  • {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/java/jdk/beta/index.html "> ibm sdk for Java 7 Open Beta project: Get license for the latest ibm sdk for Java 7 beta. Understand new technologies and features, and pass {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/forums/forum.jspa? Forumid = 2152 & cat = 10 "> the Open Beta Project Forum provides feedback.
  • Openjdk 7: open-source implementation of the next major version of the Java SE platform, which is licensed by gpl2.
  • Apache Harmony: another open-source implementation of the Java SE platform, which is licensed by Apache.
  • "{
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/java/library/j-javaroundtable/index.html "> JAVA Roundtable, spring 2010": Understand the actual situation of the future of the Java platform, because the 9 Java Community leaders have clearly pointed out that the Java industry is facing challenges.
  • IBM Java diagnostics(Developerworks, 2007-2009): Explore new IBM tools to learn how to solve Java application problems and improve their performance. The new information in this article can help you apply it to practice immediately.
  • Browse the technology bookstore to get books on various technical topics.
  • Developerworks Java Technology Zone: hundreds of articles on all aspects of Java programming.

Obtain products and technologies

  • Download Java early access provided by Oracle: download the latest preview version of JDK 7 from Oracle.

    Ibm sdk, Java technology edition, version 7 early access release: trial release of the latest version.

  • {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/java/jdk/tools/index.html "> IBM monitoring and diagnostic tools: these tools and documents help you monitor and diagnose applications and deployment problems running IBM runtime environments for Java

Discussion

  • {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/forums/forum.jspa? Forumid = 2152 & cat = 10 "> ibm sdk for Java 7 Open Beta Forum: helps shape the direction of ibm sdk for Java 7.
  • {
    Linkqueryappend (this)
    } "Href =" http://www.ibm.com/developerworks/forums/forum.jspa? Forumid = 367 "> IBM Java runtime and SDK discussion forum: Chris Bailey, technical architect of the IBM Java service and support organization, and other members of the ibm jtc team invite you to join this forum, share your experience with the various IBM runtime and toolkit and raise questions.

About the author

Chris Bailey joined IBM Java technology centre in 2000 as a graduate of southamton University. He is a technical architect of the IBM Java service and support organization and is responsible for helping ibm sdk for Java users to provide successful application deployment. Chris's work also includes collecting and evaluating emerging needs, delivering a variety of the latest debugging functions and tools, improving documentation and improving the quality of ibm sdk for Java.

  • Previous: strongly recommended: over 240 jquery plug-ins
  • Next article: differences between web1.0 and Web2.0
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.