static private void removeFromSwarm(SystemTimer t){
  final boolean isDebugEnabled=logger.isTraceEnabled();
synchronized (allSwarms) {
    ArrayList swarmSet=(ArrayList)allSwarms.get(t.swarm);
    if (swarmSet == null) {
      if (isDebugEnabled) {
        logger.trace("SystemTimer#removeFromSwarm: timer already removed: {}",t);
      }
      return;
    }
    if (isDebugEnabled) {
      logger.trace("SystemTimer#removeFromSwarm: removing timer <{}>",t);
    }
synchronized (swarmSet) {
      Iterator it=swarmSet.iterator();
      while (it.hasNext()) {
        WeakReference ref=(WeakReference)it.next();
        SystemTimer t2=(SystemTimer)ref.get();
        if (t2 == null) {
          it.remove();
          continue;
        }
        if (t2 == t) {
          it.remove();
          break;
        }
        if (t2.cancelled) {
          it.remove();
          continue;
        }
      }
      if (swarmSet.size() == 0) {
        allSwarms.remove(t.swarm);
        if (isDebugEnabled) {
          logger.trace("SystemTimer#removeFromSwarm: removed last reference to {}",t.swarm);
        }
      }
    }
  }
  sweepAllSwarms();
}

static private void removeFromSwarm ( SystemTimer t ) { final boolean isDebugEnabled = logger . isTraceEnabled ( ) ; synchronized ( allSwarms ) { ArrayList swarmSet = ( ArrayList ) allSwarms . get ( t . swarm ) ; if ( swarmSet == null ) { if ( isDebugEnabled ) { logger . trace ( "SystemTimer#removeFromSwarm: timer already removed: {}" , t ) ; } return ; } if ( isDebugEnabled ) { logger . trace ( "SystemTimer#removeFromSwarm: removing timer <{}>" , t ) ; } synchronized ( swarmSet ) { Iterator it = swarmSet . iterator ( ) ; while ( it . hasNext ( ) ) { WeakReference ref = ( WeakReference ) it . next ( ) ; SystemTimer t2 = ( SystemTimer ) ref . get ( ) ; if ( t2 == null ) { it . remove ( ) ; continue ; } if ( t2 == t ) { it . remove ( ) ; break ; } if ( t2 . cancelled ) { it . remove ( ) ; continue ; } } if ( swarmSet . size ( ) == 0 ) { allSwarms . remove ( t . swarm ) ; if ( isDebugEnabled ) { logger . trace ( "SystemTimer#removeFromSwarm: removed last reference to {}" , t . swarm ) ; } } } } sweepAllSwarms ( ) ; }
remove given timer from the swarm .
