122122 * to <tt>CLEANUP_STOP_THRESHOLD_DEFAULT</tt> (100) by default. The default is overridable in the constructor or via
123123 * #setCleanupStopThreshhold(Integer). If set to null or 0, cleanup will not stop if it is ever started.
124124 * <p/>
125- * Cleanup can be monitored by subscribing to the {@link CleanupEvent} class.
126- * <p/>
127125 * All cleanup parameters are tunable "live" and checked after each subscription and after each cleanup cycle.
128126 * To make cleanup never run, set cleanupStartThreshhold to Integer.MAX_VALUE and cleanupPeriodMS to null.
129127 * To get cleanup to run continuously, set set cleanupStartThreshhold to 0 and cleanupPeriodMS to some reasonable value,
137135 * @todo (param) a JMS-like selector (can be done in base classes by implements like a commons filter
138136 * @see EventService for a complete description of the API
139137 */
140- @ SuppressWarnings ({"unchecked" , "ForLoopReplaceableByForEach" })
138+ @ SuppressWarnings ({"unchecked" })
141139public class ThreadSafeEventService implements EventService {
142140 public static final Integer CLEANUP_START_THRESHOLD_DEFAULT = 250 ;
143141 public static final Integer CLEANUP_STOP_THRESHOLD_DEFAULT = 100 ;
@@ -2057,17 +2055,14 @@ class CleanupTimerTask extends TimerTask {
20572055 @ Override
20582056 public void run () {
20592057 synchronized (listenerLock ) {
2060- ThreadSafeEventService .this .publish (new CleanupEvent (CleanupEvent .Status .STARTING , weakRefPlusProxySubscriberCount , null ));
20612058 if (weakRefPlusProxySubscriberCount <= cleanupStopThreshold ) {
20622059 this .cancel ();
20632060 cleanupTimer = null ;
20642061 cleanupTimerTask = null ;
20652062 LOG .debug ("Cancelled scheduled weak reference and proxy cleanup." );
2066- ThreadSafeEventService .this .publish (new CleanupEvent (CleanupEvent .Status .UNDER_STOP_THRESHOLD_CLEANING_CANCELLED , weakRefPlusProxySubscriberCount , null ));
20672063 return ;
20682064 }
20692065 LOG .debug ("Starting a weak reference and proxy cleanup." );
2070- ThreadSafeEventService .this .publish (new CleanupEvent (CleanupEvent .Status .OVER_STOP_THRESHOLD_CLEANING_BEGUN , weakRefPlusProxySubscriberCount , null ));
20712066 List <Map > allSubscriberMaps = new ArrayList <Map >();
20722067 allSubscriberMaps .add (subscribersByEventType );
20732068 allSubscriberMaps .add (subscribersByEventClass );
@@ -2093,7 +2088,6 @@ public void run() {
20932088 }
20942089 }
20952090 }
2096- ThreadSafeEventService .this .publish (new CleanupEvent (CleanupEvent .Status .FINISHED_CLEANING , weakRefPlusProxySubscriberCount , staleCount ));
20972091 }
20982092 }
20992093 }
0 commit comments