|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.core.service.Service | +--org.exolab.core.service.BasicService | +--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.
Method Summary | |
boolean |
belowLowWaterThreshold()
Check whether the low water threshold has been reached. |
org.exolab.core.foundation.HandleIfc |
getHandle()
Return a handle to this event handler for the purpose of storing and restoring it. |
void |
handleEvent(int event,
java.lang.Object callback,
long time)
Handle the specified event, generated by the EventManager . |
static GarbageCollectionService |
instance()
Return the singleton instance of the GarbageCollectionService |
void |
register(GarbageCollectable entry)
Register an entity that wishes to participate in the garbage collection process. |
void |
run()
|
void |
start()
|
void |
stop()
|
void |
unregister(GarbageCollectable entry)
Unregister the specified entry from the list of garbge collectable entities |
Methods inherited from class org.exolab.core.service.BasicService |
toString |
Methods inherited from class org.exolab.core.service.Service |
getName, getState, restart, setState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public static GarbageCollectionService instance() throws GarbageCollectionServiceException
GarbageCollectionServiceException
- public boolean belowLowWaterThreshold()
public void register(GarbageCollectable entry)
entry
- - entry to add to listpublic void unregister(GarbageCollectable entry)
entry
- - entry to removepublic void run()
run
in class org.exolab.core.service.BasicService
public void start() throws org.exolab.core.service.ServiceException
start
in class org.exolab.core.service.BasicService
public void stop() throws org.exolab.core.service.ServiceException
stop
in class org.exolab.core.service.BasicService
public org.exolab.core.foundation.HandleIfc getHandle()
EventHandler
EventManager
then you must support this
method, otherwise this method can simply return null.getHandle
in interface EventHandler
org.exolab.jms.events.EventHandler
public void handleEvent(int event, java.lang.Object callback, long time)
EventHandler
EventManager
.
The event handler pressumably knows how to handle the callback object
and should cast it appropriately before using it.
This methodshould not throw any exceptions
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 |