Package gov.usgs.earthquake.distribution
Class NotificationIndexCleanup
- java.lang.Object
-
- gov.usgs.earthquake.distribution.NotificationIndexCleanup
-
- All Implemented Interfaces:
java.lang.Runnable
public class NotificationIndexCleanup extends java.lang.Object implements java.lang.RunnableNotificationIndexCleanup manages cleaning up expired notifications. Uses background thread to remove expired notifications while they exist, then uses wait/notify to pause until shutdown() or wakeUp() methods are called. NOTE: this class does not schedule periodic cleanup, and the wakeUp() method must be called periodically.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNotificationIndexCleanup.ListenerInterface for cleanup listeners to take additional steps before a notification is removed.
-
Field Summary
Fields Modifier and Type Field Description java.lang.ThreadcleanupThreadNotificationIndexindexNotificationIndexCleanup.Listenerlistenerjava.lang.ObjectsyncObject
-
Constructor Summary
Constructors Constructor Description NotificationIndexCleanup(NotificationIndex index, NotificationIndexCleanup.Listener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidrun()Notification cleanup thread loop.voidshutdown()Stop cleanup process.voidstartup()Start cleanup process.voidwakeUp()Wake up the background thread if it is waiting.
-
-
-
Field Detail
-
index
public final NotificationIndex index
-
listener
public final NotificationIndexCleanup.Listener listener
-
syncObject
public final java.lang.Object syncObject
-
cleanupThread
public java.lang.Thread cleanupThread
-
-
Constructor Detail
-
NotificationIndexCleanup
public NotificationIndexCleanup(NotificationIndex index, NotificationIndexCleanup.Listener listener)
-
-
Method Detail
-
run
public void run()
Notification cleanup thread loop. This method blocks and should probably not be called by you.- Specified by:
runin interfacejava.lang.Runnable
-
startup
public void startup() throws java.lang.ExceptionStart cleanup process.- Throws:
java.lang.Exception
-
shutdown
public void shutdown() throws java.lang.ExceptionStop cleanup process.- Throws:
java.lang.Exception
-
wakeUp
public void wakeUp()
Wake up the background thread if it is waiting.
-
-