Security policy enforcement

JDK 9 uses ConcurrentHashMap for mapping ProtectionDomain to PermissionCollection. ConcurrentHashMap is typically used for high concurrency in applications. It has the following characteristics:

  • Thread safe
  • Enter map does not need to be synchronized
  • Fast reads
  • Writes use locks
  • No object-level locking
  • Locking at a very granular level

The ConcurrentHashMap class definition follows:

    public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>      implements ConcurrentMap<K, V>, Serializable

In the preceding class definition, K refers to the type of keys maintained by the hash map and V indicates the type of mapped values. There is a KeySetView sub-class and several methods.

There are three additional classes related ...

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.