Currently the notification cache is designed to hold com.sun.am.event.notification.expire.time minutes worth of notification objects. The default and minimum value for this is 30 minutes.
Since the source of new notifications can be a completely external source (i.e persistent search results from a remote datastore) it might be useful to have further controls/measures on this cache to prevent OpenAM becoming overwhelmed with notification data in the event of an unusual external event.
Currently, if a very large set of changes gets pushed through the persistent search mechanism (could be a large data migration/import or a misbehaving remote system) OpenAM will keep storing notifications with no upper limit on total memory used for this cache. As long as network/CPU performance is high enough OpenAM can easily receive too many notifications to store in memory over a 30 minute period.
An additional mechanism to prevent the server running itself out of memory would be a useful addition for robustness purposes. Additionally, 30 minutes seems like quite a long minimum value for this cache - are there any reasons it couldn't be decreased to 10 or 15 minutes?