Ejemplo n.º 1
0
 public int deleteOld(int minsize, long maxtime) throws IOException {
   long timeout = System.currentTimeMillis() + maxtime;
   Collection<byte[]> keys = keys4LargeReferences(minsize, maxtime / 3);
   int c = 0;
   int oldShrinkMaxsize = ReferenceContainer.maxReferences;
   ReferenceContainer.maxReferences = minsize;
   for (byte[] key : keys) {
     ReferenceContainer<ReferenceType> container = this.get(key, null);
     container.shrinkReferences();
     try {
       this.add(container);
       c++;
     } catch (SpaceExceededException e) {
     }
     if (System.currentTimeMillis() > timeout) break;
   }
   ReferenceContainer.maxReferences = oldShrinkMaxsize;
   return c;
 }