Steps to reproduce:
- create 2 or more policies in a new deployment
- try to export them using ssoadm list-xacml
- set up OpenAM with external config store
- Create 1 policy
- Save it and refresh the page 10+ times
The problem seems to be that the SearchResultIterator#hasNext must be called to ensure that the underlying connection gets closed correctly. In DataStore#getPrivilege however the hasNext is only called once, and this means that the underlying connection is never actually closed/returned to the connection pool.