-
Notifications
You must be signed in to change notification settings - Fork 24
Hashed Collections
As shown by this Java performance tuning guide on HashMaps, using alternative hash map implementations from non-JDK libraries may have a significant impact on performances. AuthzForce uses Guava-based API by default (based on JDK to some extent). But you can switch to other implementations - see the previously mentioned article for examples (Koloboke, FastUtil...) - by implementing the interface HashCollectionFactory. This interface is provided by authzforce-ce-core-pdp-api
project. For example, if using Maven, you need this dependency to implement your own:
...
<dependencies>
...
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-core-pdp-api</artifactId>
<!-- Make sure this version matches the one used by the authzforce-ce-core-pdp-engine version you are using. -->
<version>13.0.0</version>
</dependency>
...
</dependencies>
...
Make sure the version matches the one used by the authzforce-ce-core-pdp-engine
version you are using.
Once your implementation is ready, make sure it is available on the classpath at runtime, and specify your own implementation class with a Java system property, the name of which is defined by Java constant HASH_COLLECTION_FACTORY_SYSTEM_PROPERTY_NAME of HashCollections class. As of writing, this is org.ow2.authzforce.core.pdp.api.HashCollectionFactoryClass
, so you could use a JVM argument like -Dorg.ow2.authzforce.core.pdp.api.HashCollectionFactoryClass=com.example.MyHashCollectionFactory
. However, this property name may change in the future, so take the Javadoc link as reference.