Iterator j = topicSubscriptions.values( ).iterator( );
while ( j.hasNext( ) )
{ // loop through each subscription in the topic subscriptions map
Subscription subscription = (Subscription) j.next( );
if ( subscription.getResourceProps( ).getTerminationTime( ).getTime( ).before( now ) )
{
doomedSubcriptions.add( subscription );
}
}
// now remove the expired subscriptions
// we do this in a separate while loop to avoid modifying the topicSubscriptions map during iteration
Iterator subsIter = doomedSubcriptions.iterator( );
while ( subsIter.hasNext( ) )
{
Subscription doomedSub = (Subscription) subsIter.next( );
topicSubscriptions.remove( doomedSub.getSubscriptionId( ) );
destroySubscriptionWSResource( doomedSub );
}
// if we've removed all subscriptions in the current topic map, designated it to be removed from m_subscriptions
if ( topicSubscriptions.isEmpty( ) )