TransferQueue has been added. It is a refinement of the BlockingQueue
interface in which producers can wait for consumers to receive elements. One implementation of the new interface is also included in this release,
Java SE 7u6 introduces an improved, alternative hash function for the following map and map-derived collection implementations:
The alternative hash function improves the performance of these map implementations when a large number of key hash collisions are encountered.
For Java SE 7u6, this alternative hash function is implemented as follows:
The alternative hash function is only applied to keys of type
The alternative hash function is only applied to maps with a capacity larger than a specified threshold size. By default, the threshold is
-1. This value disables the alternative hash function. To enable the alternative hash function (which is only applied to keys of type
String), set the
jdk.map.althashing.threshold system property to a different value. The recommended value is
512. Setting this system property to
512 causes all maps with a capacity larger than 512 entries to use the alternative hash function. You can set this system property to
0, which causes all maps to use the alternative hash function.
The following describes the
jdk.map.althashing.threshold system property in more detail:
String. The value
-1is a synonym for
2147483647(which is easier to remember). All other values correspond to threshold capacity.
For example, the following command runs the Java application
MyApplication and sets the
jdk.map.althashing.threshold system property to
java -Djdk.map.althashing.threshold=512 MyApplication
If the alternative hash function is being used, then the iteration order of keys, values, and entities vary for each instance of
ConcurrentHashMap. This change in iteration order may cause compatibility issues with some programs. This is the reason that the alternative hash function is disabled by default. Hashing improvements will be investigated in future releases. In the meantime, the system property
jdk.map.althashing.threshold is experimental. It is strongly recommended that you test your applications with the alternative hashing function enabled (by setting
jdk.map.althashing.threshold to 0) to determine if your applications are affected by iteration order. If there is an impact, you should fix your applications as soon as possible because there is no guarantee of iteration order.