Ejemplo n.º 1
0
 public IVideo retrieve(String siteId) {
   VideoTimeStampPair pair = null;
   synchronized (waitingList) {
     pair = waitingList.remove(siteId);
   }
   if (pair == null) return null;
   else return pair.getVideo();
 }
Ejemplo n.º 2
0
 private void checkTimeout() {
   long curTime = System.currentTimeMillis();
   synchronized (waitingList) {
     Iterator it = waitingList.keySet().iterator();
     while (it.hasNext()) {
       String siteId = (String) it.next();
       VideoTimeStampPair pair = waitingList.get(siteId);
       if (curTime - pair.getTimestamp() > timeout) it.remove();
     }
   }
 }