Java JDK Version (2)-JDK7 new features

Source: Internet
Author: User
Tags locale rfc

http://www.ibm.com/developerworks/cn/java/j-lo-jdk7-1/

JSR292: Supports dynamic type language (invokedynamic)

In recent years, the emergence of more and more JVM-based dynamic languages presents new requirements and challenges for the JVM. In fact, the scripting language on the Jsr223:java platform has been supported in JDK6, and scripting languages such as JavaScript are executed on the JVM through a scripting language engine. However, since the JVM itself is designed to be a static type language of Java, the scripting language will have a great impact on execution efficiency, whether it is the interpretation execution, the virtual type at compile time or the reflection mechanism.

The implementation of JSR292 adds a invokedynamic bytecode directive to support dynamic type languages, making it not necessary to determine the signature of the method when compiling the source code into bytecode, that is, the type of the method parameter and the return type. When the runtime executes the invokedynamic instruction, the JVM will find the real way through the new dynamic link mechanism method Handles.

With invokedynamic, the dynamic type language performs significantly faster on the JVM.

G1 garbage collector (Garbage-first Collector)

The G1 garbage collector is a server-side garbage collector that targets large-memory multi-core CPUs in order to reduce the number of pauses caused by full GC and increase throughput. In the long run, G1 will replace Concurrent mark-sweep Collector (CMS). Implementation, G1 allocates a series of contiguous regions of the same size on the heap, then scans all the regions at the time of collection, sorts the size of the surviving objects in each area, prioritizes the small areas of the surviving objects, that is, the area with the largest number of garbage objects, which is the origin of the name Garbage first. G1 merges and replicates the surviving objects in the area to be collected to other regions, thus avoiding the memory fragmentation problems encountered by the CMS. In addition, the G1 uses a predictable pause time model to achieve soft real-time requirements.

JSR334: Small language improvements (Project Coin)

The Coin project offers a range of language improvements that provide more convenience for Java developers. It includes a switch statement that supports String, a resource is automatically closed after a try (try-with-resources), a cleaner generic, numbers can be underlined and multiple catch improvements, and so on.

Core Class Library improvements ClassLoader new API

The Java.lang.ClassLoader class adds the following APIs to prevent the deadlock problem that is generated by customizing multithreaded Classload.

Protected Object Getclassloadinglock (String className)  protected Static Boolean registerasparallelcapable ()

For more information, please refer to JDK7 's official documentation.

URLClassLoader New API

URLClassLoader new Close method to close the resource opened by the ClassLoader.

Improvement of Concurrent Package

The Java.util.concurrent package introduces a lightweight Fork/join framework to support concurrent computing of multicore multithreading. In addition, the Phaser class is implemented, which is similar to Cyclicbarrier and countdownlatch but more flexible. Finally, the Threadlocalrandom class provides a thread-safe pseudo-random number generator.

Internationalization (i18n)

Supports Unicode 6.0. Improved Java.util.Locale to support IETF BCP 47 and UTR 35, and was divided into locale for display and locale for formatting when get/set locale.

I/O and the Web Java platform for more new NIO 2 API (JSR 203)

The NIO2 mainly includes 3 improvements:

    1. The new file system API supports access to a large number of file attributes, file system monitoring services, platform-related APIs such as Dosfileattributes and Posixfileattributes, and an SPI for pluggable file systems.
    2. Asynchronous IO for sockets and files.
    3. The Socket channel is fully functional and supports binding, multicasting, and so on.
Support for the Filesystemprovider implementation of Zip/jar

NIO2 provides a new service provider Java.nio.file.spi.FileSystemProvider to implement a file system, and provides a Zip/jar file system example in the demo.

SCTP (Stream Control transmission Protocol)

Implementation of the SCTP protocol, the flow control transport protocol, is regulated by RFC 2960. It is a reliable transport protocol similar to TCP. SCTP provides a stable, ordered data delivery service between two endpoints (very similar to TCP) and can protect data message boundaries (such as UDP). However, unlike TCP and UDP, SCTP provides these benefits through multi-homed (multi-homing) and multi-stream (multi-streaming) capabilities, both of which increase availability.

SDP (Socket Direct Protocol)

SDP, socket-oriented protocol, provides high-throughput, low-latency, high-performance network connectivity. It is designed to enable applications to transparently utilize the RDMA (Remote Direct Memory Access) communication mechanism to accelerate traditional TCP/IP network traffic. Originally SDP was designated by the Infiniband Industry Association's software Working group, primarily for the Infiniband architecture, and later SDP evolved into an important protocol for transmitting with RDMA features. JDK7 this time to implement the SDP on the Solaris and Linux platforms.

Using the IPV6 stack on Windows Vista

Updated the code for the network, and on Windows Vista, when the IPV6 stack is available, use the IPV6 stack preferentially.

Graphical interface Client Swing's Nimbus look and feel

Nimbus is a new generation of cross-platform appearance sensations on Swing (look & Feel). In fact, Nimbus already exists in Java 6, but until Java 7 is moved to the standard Swing's namespace (javax.swing). It turns out that the default cross-platform look in Java is "metal" (Metal) or a Java look-and-feel. Nimbus initially as an open source project, it uses java2d vector drawing instead of bitmap images to render graphical interface controls, thus allowing graphical interface controls to be arbitrarily scaled. This feature is particularly consistent with the development trend of modern rich client graphics controls.

Jlayer

Typically, the drawing of a custom graphical control requires a drawing method of the control, but in many cases this is not a good idea. As a result, the Jlayer class came into being, and it could be adorned with existing Swing components. This allows the interface component to complete custom rendering and event responses without being modified. An example is to decorate a custom background for all controls on a window, such as all pixels in a blurred interface. If you are interested in this, you can refer to the Jlayer official tutorial.

Mixing heavyweight and lightweight components

There are two classes, heavyweight (heavyweight), and lightweight (lightweight) controls in Java graphics controls. Lightweight controls do not have corresponding operating system local controls, such as most Swing controls: JLabel and JButton. The heavyweight controls, in contrast, correspond to local controls, such as the Button and Label of AWT. Historically, there have been problems with mixing heavyweight and lightweight controls in a form, especially when they overlap each other. Now, mixed use in Java 7 becomes more convenient.

Irregular and transparent forms

The API for creating irregular and transparent forms is formally introduced in Java 7 to expose the AWT package. Of course, these cool features require the support of the system's underlying graphical interface. The relevant APIs are listed below

    • Graphicsdevice.iswindowtranslucencysupported (windowtranslucency)
    • Graphicsconfiguration.istranslucencycapable ()
    • Window.setopacity (float)
    • Window.setshape (Shape)
    • Window.setbackground (Color)

For more information, see the Tutorial "How to Create translucent and shaped Windows" for an API to learn how to use transparent irregular forms.

Back to top of page

Other module XML

Update the latest XML components to a stable version of the relevant open source implementation: JAXP 1.4, JAXB 2.2a, Jax-ws 2.2.

Java 2D
    • For modern X11 desktop systems, a XRender-based rendering pipeline is available.
    • Added support for OPENTYPE/CFF fonts.
    • For better support for Linux fonts, use Libfontconfig to select Fonts.
Security/Encryption
    • Elliptic curve Cryptography (ECC) provides a portable standard elliptic curve encryption algorithm, and all Java applications can use elliptic curve encryption algorithm.
    • JSSE (SSL/TLS)
      • Setting off weak encryption algorithms in certificate chain authentication, such as the MD2 algorithm, has been proven to be less secure.
      • Increased support for TLS (Transport Layer Security) 1.1 and 1.2, which correspond to RFC 4346 and RFC 5246, respectively.
      • SNI (Server Name Indication) is supported, and its specifications are defined in RFC 4366.
      • TLS key renegotiation mechanism, RFC 5746.
Database connection (JDBC)

Spec JDBC 4.1 and Rowset 1.1 are supported.

Back to top of page

IBM JDK 7 new features

In addition to the above-mentioned JDK 7 new specifications, IBM JDK 7 has its own unique new features. IBM JDK 7 supports more IBM platforms, such as AIX, z/OS, IBM I platforms, and optimizes performance with proprietary hardware directives on these IBM hardware and software platforms, making IBM JDK7 with IBM platforms much faster than other combinations of the same level. In addition, the IBM J9 JVM also has excellent performance in other equivalent platform environments, and there are a number of special optimizations for specific situations that allow for better performance in these cases than other JDK 7.

And ORACLEJDK started introducing the G1 garbage collector to reduce the number of full GC pauses, IBM JDK7 uses the generational concurrent garbage collector (the parameter is-xgcpolicy:gencon) by default. IBM JDK 7 also introduced an evaluation version of the real-time incremental garbage collection policy (parameter-xgcpolicy:metronome) to better match the WebSphere RealTime.

Summarize

This overview briefly introduces the main new features of JDK7. While it is regrettable that improvements in collections such as LAMBDA, Jigsaw and Coin have been forced to be postponed to JDK8, it is gratifying to find that Java is becoming an increasingly comprehensive and robust security platform, as the original Java design White paper says, and its language is simple and concise.

Java JDK Version (2)-JDK7 new features

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.