コード例 #1
0
    public void run() {
      while (running) {
        try {
          update();
        } catch (MVRuntimeException e) {
          Log.exception("ProximityTracker.Updater.run caught MVRuntimeException", e);
        } catch (Exception e) {
          Log.exception("ProximityTracker.Updater.run caught exception", e);
        }

        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          Log.warn("Updater: " + e);
          e.printStackTrace();
        }
      }
    }
コード例 #2
0
 public void removeTrackedPerceiver(Long perceiverOid) {
   lock.lock();
   try {
     // Iterate over perceived objects, removing our
     // perceiverOid from their oid sets.
     PerceiverData perceiverData = perceiverDataMap.get(perceiverOid);
     if (perceiverData != null) {
       if (Log.loggingDebug)
         Log.debug(
             "ProximityTracker.removeTrackedPerceiver: perceiverOid "
                 + perceiverOid
                 + ", inRangeOids count "
                 + perceiverData.inRangeOids.size());
       // Iterate over perceived objects, removing our
       // perceiverOid from their oid sets.
       for (Long perceivedOid : perceiverData.perceivedOids) {
         PerceiverData perceivedData = perceiverDataMap.get(perceivedOid);
         if (perceivedData != null) {
           perceivedData.perceivedOids.remove(perceiverOid);
           if (perceivedData.inRangeOids.contains(perceiverOid)) {
             perceivedData.inRangeOids.remove(perceiverOid);
             performNotification(perceiverOid, perceivedOid, false, true);
           }
         }
       }
       perceiverData.perceivedOids.clear();
       perceiverData.inRangeOids.clear();
       perceiverDataMap.remove(perceiverOid);
     } else
       Log.warn(
           "ProximityTracker.removeTrackedPerceiver: For oid="
               + perceiverOid
               + ", didn't find PerceiverData");
   } finally {
     lock.unlock();
   }
   if (Log.loggingDebug)
     Log.debug(
         "ProximityTracker.removeTrackedPerceiver: oid="
             + perceiverOid
             + " instanceOid="
             + instanceOid);
 }