Collections Framework Enhancements
The purpose of changes in this API is to provide better bi-directional collection access.
These new collection interfaces are provided:
- Deque - a double ended queue, supporting element insertion and removal at both ends. Extends the Queue interface.
- BlockingDeque - a Deque with operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element. Extends both the Deque and BlockingQueue interfaces. (This interface is part of java.util.concurrent.)
- NavigableSet - a SortedSet extended with navigation methods reporting closest matches for given search targets. A NavigableSet may be accessed and traversed in either ascending or descending order. This interface is intended to supersede the SortedSet interface.
- NavigableMap - a SortedMap extended with navigation methods returning the closest matches for given search targets. A NavigableMap may be accessed and traversed in either ascending or descending key order. This interface is intended to supersede the SortedMap interface.
- ConcurrentNavigableMap - a ConcurrentMap that is also a NavigableMap. (This interface is part of java.util.concurrent.)
- ArrayDeque - efficient resizable-array implementation of the Deque interface.
- ConcurrentSkipListSet - concurrent scalable skip list implementation of the NavigableSet interface.
- ConcurrentSkipListMap - concurrent scalable skip list implementation of the ConcurrentNavigableMap interface.
- LinkedBlockingDeque - concurrent scalable optionally bounded FIFO blocking deque backed by linked nodes.
- AbstractMap.SimpleEntry - simple mutable implementation of Map.Entry
- AbstractMap.SimpleImmutableEntry - simple immutable implementation of Map.Entry
- LinkedList - retrofitted to implement the Deque interface.
- TreeSet - retrofitted to implement the NavigableSet interface.
- TreeMap - retrofitted to implement the NavigableMap interface.
-
newSetFromMap(Map) - creates a general purpose
Set implementation from a general purpose Map
implementation.
There is no IdentityHashSet class, but instead, just
use
Set<Object> identityHashSet= Collections.newSetFromMap( new IdentityHashMap<Object, Boolean>());
- asLifoQueue(Deque) - returns a view of a Deque as a Last-in-first-out (Lifo) Queue.
Before:
int[] newArray = new int[newLength]; System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
After:
int[] newArray = Arrays.copyOf(a, newLength);
2. Java Web Start and Java Plug-in Common Enhancements
Cache and System Format
The format of the cache is completely changed and should never be assumed. Any existing code using the previous cache format for Java Web Start or Java Plug-in will no longer work. Existing applications in the Java Web Start cache will be upgraded and converted to the new cache format the first time you run a Java Web Start application, or if you launch the cache viewer usingjavaws -viewer.
The system cache will be upgraded and converted to the new format the first time you launch Java Web Start in system mode, or if you just launch
javaws -system.
Download Engine and Cache Consolidation
The caching mechanism and download engine are redesigned and consolidated between Java Web Start and Java Plug-in. This brings several new features to Java Web Start, previously available only in Java Plug-in and vice versa. They are :- Caching can be disabled using the Java Control Panel.
- Java Web Start honors the maximum cache size set using Java Control Panel.
- Java Web Start can start a cleanup thread to remove Least Recently Used(LRU) items from the cache when approaching the maximum cache size.
- The
<no-cache>
directive is now supported. When the no-cache directive is used , an update check is made to make sure the cached contents are same as at the URL. The resource is then downloaded into the cache and the expiration field is ignored. - The expiration-date is supported. If a downloaded resource contains an expiration date, it will not be used after that date.
Secure Versioning
In Java SE 6 unsigned Java Web Start applications that specify a version other than the latest one will trigger a security warning, requiring explicit user permission before the application will run. Signed Java Web Start applications are not affected.Other Enhancements
Java Web Start and Java Plug-in now support CRL (Certificate Revocation Lists) and OCSP (Online Certificate Status Protocol) for verifying the certificates.Java Control Panel provides an option to select the default SSL handshaking protocol. The default is set to SSLv3 and SSLv2. You can also change it to TSL.
The Java Console is excluded from modality. By using the new modality features of AWT in Java 6, you can interact with Java Console even when your application is displaying a modal dialog.
All dialogs and screens of Java Web Start and Java Plug-in are
redesigned to be more user friendly, intuitive, and accessible.
3. Internationalization Support
Internationalization is the process of designing an application so that it can be adapted to various languages and regions without engineering changes. Sometimes the term internationalization is abbreviated as i18n, because there are 18 letters between the first "i" and the last "n."An internationalized program has the following characteristics:
- With the addition of localization data, the same executable can run worldwide.
- Textual elements, such as status messages and the GUI component labels, are not hardcoded in the program. Instead they are stored outside the source code and retrieved dynamically.
- Support for new languages does not require recompilation.
- Culturally-dependent data, such as dates and currencies, appear in formats that conform to the end user's region and language.
- It can be localized quickly.
4. IO Support
java.io
One new class is provided:Console
- Contains methods to access a character-based console device. ThereadPassword()
methods disable echoing thus they are suitable for retrieval of sensitive data such as passwords. The methodSystem.console()
returns the unique console associated with the Java Virtual Machine.
File
:- Methods to retrieve disk usage information:
getTotalSpace()
returns the size of the partition in bytesgetFreeSpace()
returns the number of unallocated bytes in the partitiongetUsableSpace()
returns the number of bytes available on the partition and includes checks for write permissions and other operating system restrictions
- Methods to set or query file permissions:
setWritable(boolean writable, boolean ownerOnly)
andsetWritable(boolean writable)
set the owner's or everybody's write permissionsetReadable(boolean readable, boolean ownerOnly)
andsetReadable(boolean readable)
set the owner's or everybody's read permissionsetExecutable(boolean executable, boolean ownerOnly)
andsetExecutable(boolean executable)
set the owner's or everybody's execute permissioncanExecute()
tests the value of the execute permission
IOException
supports exception chaining via the addition of the new constructorsIOException(String, Throwable)
andIOException(Throwable)
.
- The
File.isFile()
Windows implementation has been modified to always returnfalse
for reserved device names such as CON, NUL, AUX, LPT, etc. Previously it returnedtrue
, which customers considered a bug because it was inconsistent with behavior for devices on Unix.
java.nio
- A new
java.nio.channels.SelectorProvider
implementation that is based on the Linux epoll event notification facility is included. The epoll facility is available in the Linux 2.6, and newer, kernels. The new epoll-basedSelectorProvider
implementation is more scalable than the traditional poll-basedSelectorProvider
implementation when there are thousands ofSelectableChannel
s registered with aSelector
. The newSelectorProvider
implementation will be used by default when the 2.6 kernel is detected. The poll-basedSelectorProvider
will be used when a pre-2.6 kernel is detected. - The system property
sun.nio.ch.disableSystemWideOverlappingFileLockCheck
controls whetherjava.nio.channels.FileChannel.lock()
checks whether regions are locked by other instances ofFileChannel
. Unless this system property is set totrue
,FileChannel.lock()
will throw anOverlappingFileLockException
if an application attempts to lock a region that overlaps one that is locked by another instance ofFileChannel
. The system property exists to provide compatibility with previous releases which do not implement the JVM-wide overlapping file lock check.
No comments:
Post a Comment