public void unregister ( ActiveObject object ) { synchronized ( watchList ) { for ( int i = 0 ; i < watchList . size ( ) ; i ++ ) { WeakReference < ActiveObject > weakRef = watchList . get ( i ) ; ActiveObject obj = weakRef . get ( ) ; if ( obj == null ) { // Object was garbage collected, remove and continue watchList . remove ( i -- ) ; continue ; } if ( obj == object ) { // Found it ! watchList . remove ( i ) ; break ; } } } }
Unregister a monitored active object