|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.service.Service | +--org.exolab.jms.gc.GarbageCollectionService
The garbage collection service is responsible for managing all transient
garbage collection for OpenJMS, which includes messages, destinations,
endpoints etc. It does not deal with persistent data, which is handled
through the database service. Other services or managers can register
themselves with GarbageCollectionService if they implement the GarbageCollectable
interface.
Gargabe collection will be initiated when the amount of free memory falls below a low water mark, which is calculated as a percentage of total memory. By default garbage collection will run when free memory falls below 20% of total memory, this can be changed through the configuration file.
The service will check the memory usage every 30 seconds by default. but this can also be modified through the configuration file.
In addition the garbage collection service can also be configured to execute at regular intervals regardless the amount of residual free memory. This option can be employed to ease the burden of performing wholesale garbage collection when memory falls below the low water mark threshold. The default value for this is 300 seconds. Setting this value to 0 will disable this capability.
This service makes use of the BasicEventManager
to register events
for garbage collection.
Constructor Summary | |
GarbageCollectionService(Configuration config,
EventManager eventMgr)
Create an instance of a garbage collection service. |
Method Summary | |
boolean |
belowLowWaterThreshold()
Check whether the low water threshold has been reached. |
void |
doStart()
Start the service. |
void |
handleEvent(int event,
java.lang.Object callback,
long time)
Handle the specified event, generated by the EventManager . |
void |
register(GarbageCollectable entry)
Register an entity that wishes to participate in the garbage collection process. |
void |
unregister(GarbageCollectable entry)
Unregister the specified entry from the list of garbge collectable entities |
Methods inherited from class org.exolab.jms.service.Service |
doStop, getName, isStarted, restart, start, stop, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GarbageCollectionService(Configuration config, EventManager eventMgr)
config
- the configuration to useeventMgr
- the event managerMethod Detail |
public boolean belowLowWaterThreshold()
public void register(GarbageCollectable entry)
entry
- the entry to add to listpublic void unregister(GarbageCollectable entry)
entry
- - entry to removepublic void doStart() throws ServiceException
Service
doStart
in class Service
org.exolab.jms.service.Service
ServiceException
- if the service fails to startpublic void handleEvent(int event, java.lang.Object callback, long time)
EventHandler
EventManager
.handleEvent
in interface EventHandler
org.exolab.jms.events.EventHandler
event
- the event to handlecallback
- the callback objecttime
- the absolute time, in ms, that the event fired
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |