The OpenJMS server periodically runs a garbage collector to conserve memory. Garbage collection will also be run if available memory falls below a configured threshold.
The garbage collector collects:
These are messages whose JMSExpiration property is non-zero, and the time indicated by the property has passed.
Expired messages are removed both from memory and/or the database if they are persistent.
Messages are cached on a per-destination basis. A topic message cache will be garbage collected if it has no active consumers. A queue message cache will be garbage collected if it has no active consumers and:
QueueBrowsercurrently registered with the message cache.
These are messages cached in memory to avoid the overhead reading them from the database. These are removed from memory when available memory is low.
The garbage collector is configured via the <GarbageCollectionConfiguration> element in the $OPENJMS_HOME/config/openjms.xml configuration file:
<GarbageCollectionConfiguration memoryCheckInterval="30" lowWaterThreshold="20" garbageCollectionInterval="600" garbageCollectionThreadPriority="5"/>
The following references provide detailed descriptions of the configuration elements related to garbage collection: