43. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:35 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

43.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\impl\eviction StorageThresholdEvictionStrategy.java Mon Dec 4 21:35:30 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\impl\eviction StorageThresholdEvictionStrategy.java Mon Dec 4 21:57:25 2017 UTC

43.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 1066
Changed 3 6
Inserted 0 0
Removed 0 0

43.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

43.4 Active regular expressions

No regular expressions were active.

43.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.sto rage.cache .impl.evic tion;
  5  
  6   import gov .va.med.im aging.stor age.cache. *;
  7   import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption;
  8   import gov .va.med.im aging.stor age.cache. impl.Group EvictionCa ndidateVis itor;
  9   import gov .va.med.im aging.stor age.cache. impl.Group Path;
  10   import gov .va.med.im aging.stor age.cache. impl.Targe tSizeGroup PathSet;
  11  
  12   import jav a.text.Dat eFormat;
  13   import jav a.util.*;
  14   import jav a.util.con current.*;
  15  
  16   import org .apache.lo gging.log4 j.LogManag er;
  17   import org .apache.lo gging.log4 j.Logger;
  18  
  19   /**
  20    * An evic tion strat egy realiz ation that  uses a mi nimum free  space and /or maximu m used spa ce 
  21    * to dete rmine when  to evict  groups.
  22    * 
  23    * This cl ass will e vict group s so that  the total  of the use d spaces i s the less er of
  24    * the max UsedSpaceT hreshold -  minFreeSp aceThresho ld or the  total 
  25    * availab le space -  minFreeSp aceThresho ld.
  26    * If eith er thresho ld is exce eded then  this evict ion strate gy will at tempt to e vict
  27    * groups  such that  the result ing total  size will  be near th e targetFr eeSpaceThr eshold.
  28    * 
  29    * The par ameters ar e restrict ed in valu e as follo ws:
  30    * 1.) min FreeSpaceT hreshold < = targetFr eeSpaceThr eshold
  31    * 2.) max UsedSpaceT hreshold < = availabl e space 
  32    *     (de termined a t runtime,  the value  of maxUse dSpaceThre shold is r educed to  available  space if g reater)
  33    * 
  34    * This ev iction str ategy runs  periodica lly, on ea ch iterati on it:
  35    * 1.) For  each regi on 
  36    *     Che cks if the  free spac e has fall en below a  minimum
  37    * 1b.) If  the free  space has  fallen bel ow a minim um or then  
  38    *      St arts a tas k on a thr ead pool ( a Region S weep Task)
  39    *      If  the maxim um used sp ace proper ty is grea ter than 0  then the  collective  size
  40    *      of  the manag ed regions  is determ ined using  the same  thread
  41    * 2.) Eac h Region S weep Task  creates a  set of evi ction cand idates tha t are the  LRU groups  
  42    *     who se collect ive size f alls just  below the  target siz e.
  43    * 3.) Sta rts, yet a nother, th read (the  Evictor Ta sk) that a ggregates  the set of  eviction  candidates  
  44    *     fro m each reg ion such t hat they a re collect ively the  LRU of all  the regio ns (whose  total size  falls 
  45    *     jus t below th e target s ize) and t hen remove s the grou ps in the  (collectiv e) evictio n candidat e set.
  46    * 
  47    * NOTE: t here is a  problem he re.  This  will work  fine as lo ng as all  of the Reg ions that  are manage d
  48    * by this  EvictionS trategy ar e persiste d on the s ame device .  
  49    * It is p ermissable  to have m ultiple in stances of  this Evic tionStrate gy, one fo r each dev ice, then 
  50    * each Re gion on th at device  can use th e same ins tance of t his evicti on strateg y.
  51    * 
  52    * @author         
BECKEC
  53    *
  54    */
  55   public cla ss Storage ThresholdE victionStr ategy
  56   extends Pe riodicSwee pEvictionS trategy
  57   implements  EvictionS trategy, S torageThre sholdEvict ionStrateg yMBean
  58   {
  59           pu blic final  static lo ng minimum Delay = 0;                // imm ediate
  60           pu blic final  static lo ng minimum Interval =  1000;         // 1 s econd, whi ch is real ly short e xcept for  transient  caches
  61           
  62           pu blic final  static St ring delay PropertyKe y = "delay ";
  63           pu blic final  static St ring inter valPropert yKey = "in terval";
  64           pu blic final  static St ring minFr eeSpacePro pertyKey =  "minimumF reeSpace";
  65           pu blic final  static St ring targe tFreeSpace PropertyKe y = "targe tFreeSpace ";
  66           pu blic final  static St ring maxUs edSpacePro pertyKey =  "maximumU sedSpace";
  67  
  68           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ===
  69           //  
  70           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ===
  71           
  72           /* *
  73            *  Required  Factory Me thod
  74            * /
  75           st atic Stora geThreshol dEvictionS trategy cr eate(Prope rties prop , Eviction Timer time r)
  76           th rows Cache Exception 
  77           {
  78                    Stri ng name =  (String)pr op.get(Sim pleEvictio nStrategy. nameProper tyKey);
  79                    bool ean initia lized = (( Boolean)pr op.get(Sim pleEvictio nStrategy. initialize dPropertyK ey)).boole anValue();
  80                    long  delay = ( (Long)prop .get(delay PropertyKe y)).longVa lue();
  81                    long  interval  = ((Long)p rop.get(in tervalProp ertyKey)). longValue( );
  82                    long  minFreeSp aceThresho ld = prop. get(minFre eSpaceProp ertyKey) = = null ?
  83                             -1L : 
  84                             ((Long )prop.get( minFreeSpa ceProperty Key)).long Value();
  85                    long  targetFre eSpaceThre shold = pr op.get(tar getFreeSpa ceProperty Key) == nu ll ? 
  86                             -1L : 
  87                             ((Long )prop.get( targetFree SpacePrope rtyKey)).l ongValue() ;
  88                    long  maxUsedSp aceThresho ld = prop. get(maxUse dSpaceProp ertyKey) = = null ?
  89                             -1 : 
  90                             ((Long )prop.get( maxUsedSpa ceProperty Key)).long Value();
  91                    
  92                    retu rn new Sto rageThresh oldEvictio nStrategy(  
  93                                      name, in itialized,  timer, 
  94                                      minFreeS paceThresh old, targe tFreeSpace Threshold,  maxUsedSp aceThresho ld, 
  95                                      delay, i nterval );
  96           }
  97           
  98           /* *
  99            *  @param me mento
  100            *  @param ti mer
  101            *  @return
  102            * /
  103           st atic Evict ionStrateg y create(S torageThre sholdEvict ionStrateg yMemento m emento, Ev ictionTime r timer)
  104           th rows Cache Exception 
  105           {
  106                    retu rn new Sto rageThresh oldEvictio nStrategy( timer, mem ento);
  107           }
  108  
  109           /* *
  110            *  
  111            *  @param na me
  112            *  @param in itialized
  113            *  @param ev ictionTime r
  114            *  @param mi nFreeSpace Threshold
  115            *  @param ta rgetFreeSp aceThresho ld
  116            *  @param ma xUsedSpace Threshold
  117            *  @param de lay
  118            *  @param in terval
  119            *  @return
  120            *  @throws C acheExcept ion
  121            * /
  122           st atic Evict ionStrateg y create(
  123                    Stri ng name, b oolean ini tialized, 
  124                    Evic tionTimer  evictionTi mer, 
  125                    long  minFreeSp aceThresho ld, long t argetFreeS paceThresh old, long  maxUsedSpa ceThreshol d,
  126                    long  delay, lo ng interva l) 
  127           th rows Cache Exception
  128           {
  129                    retu rn new Sto rageThresh oldEvictio nStrategy(
  130                                      name, in itialized,  
  131                                      eviction Timer, 
  132                                      minFreeS paceThresh old, targe tFreeSpace Threshold,  maxUsedSp aceThresho ld,
  133                                      delay, i nterval);
  134           }
  135           
  136           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ===
  137           //  
  138           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ===
  139           
  140           pr ivate fina l long del ay;
  141           pr ivate fina l long int erval;
  142  
  143           pr ivate long  minFreeSp aceThresho ld;
  144           pr ivate long  targetFre eSpaceThre shold;
  145           pr ivate long  maxUsedSp aceThresho ld;
  146  
  147           pr ivate Swee pStatistic s lastSwee pStatistic s = new Sw eepStatist ics(System .currentTi meMillis() , 0);
  148           
  149           pr ivate Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  150  
  151           pr ivate Stor ageThresho ldEviction Strategy(
  152                             Evicti onTimer ev ictionTime r,
  153                             Storag eThreshold EvictionSt rategyMeme nto mement o
  154           ) 
  155           th rows Cache Exception 
  156           {
  157                    this (
  158                             mement o.getName( ),
  159                             mement o.isInitia lized(), 
  160                             evicti onTimer,
  161                             mement o.getMinFr eeSpaceThr eshold(),
  162                             mement o.getTarge tFreeSpace Threshold( ),
  163                             mement o.getMaxUs edSpaceThr eshold(),
  164                             mement o.getDelay (),
  165                             mement o.getInter val()
  166                    );
  167           }
  168           
  169           pr ivate Stor ageThresho ldEviction Strategy(
  170                             String  name, 
  171                             boolea n initiali zed,
  172                             Evicti onTimer ev ictionTime r, 
  173                             long m inFreeSpac eThreshold
  174                             long t argetFreeS paceThresh old,
  175                             long m axUsedSpac eThreshold ,
  176                             long d elay, 
  177                             long i nterval) 
  178           th rows Cache Exception
  179           {
  180                    supe r(name, ev ictionTime r);
  181                    
  182                    // i t looks li ke we're s etting min FreeSpaceT hreshold t wice in th e followin g code
  183                    // a nd we are  but ...
  184                    // t he call to  setMinFre eSpaceThre shold will  invoke bo unds check ing that i s not done  by simply
  185                    // s etting the  field.  s etTargetFr eeSpaceThr eshold rel ies on the  value of 
  186                    // m inFreeSpac eThreshold , so that  must be se t before c alling set TargetFree SpaceThres hold.
  187                    this .minFreeSp aceThresho ld = minFr eeSpaceThr eshold;
  188                    setT argetFreeS paceThresh old(target FreeSpaceT hreshold);
  189                    setM inFreeSpac eThreshold (minFreeSp aceThresho ld);
  190                    setM axUsedSpac eThreshold (maxUsedSp aceThresho ld);
  191                    
  192                    this .delay = M ath.max(mi nimumDelay , delay);
  193                    this .interval  = Math.max (minimumIn terval, in terval);
  194                    setI nitialized (initializ ed);
  195           }
  196           
  197           /*  (non-Java doc)
  198            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #getDelay( )
  199            * /
  200           pu blic long  getDelay()
  201           {
  202                    retu rn this.de lay;
  203           }
  204  
  205           /*  (non-Java doc)
  206            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #getInterv al()
  207            * /
  208           pu blic long  getInterva l()
  209           {
  210                    retu rn this.in terval;
  211           }
  212  
  213           /*  (non-Java doc)
  214            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #getMinFre eSpaceThre shold()
  215            * /
  216           pu blic long  getMinFree SpaceThres hold()
  217           {
  218                    retu rn this.mi nFreeSpace Threshold;
  219           }
  220  
  221           /*  (non-Java doc)
  222            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #setMinFre eSpaceThre shold(long )
  223            * /
  224           pu blic void  setMinFree SpaceThres hold(long  minFreeSpa ceThreshol d)
  225           {
  226                    // m inFreeSpac eThreshold  must be p ositive
  227                    minF reeSpaceTh reshold =  Math.max(m inFreeSpac eThreshold , 0L);
  228                    // m inFreeSpac eThreshold  must be l ess than o r equal to  the targe tFreeSpace Threshold
  229                    minF reeSpaceTh reshold =  Math.min(m inFreeSpac eThreshold , getTarge tFreeSpace Threshold( ));
  230                    
  231                    this .minFreeSp aceThresho ld = minFr eeSpaceThr eshold;
  232                    logg er.info("S etting min imum free  space thre shold to "  + this.mi nFreeSpace Threshold) ;
  233           }
  234  
  235           /*  (non-Java doc)
  236            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #getTarget FreeSpaceT hreshold()
  237            * /
  238           pu blic long  getTargetF reeSpaceTh reshold()
  239           {
  240                    retu rn this.ta rgetFreeSp aceThresho ld;
  241           }
  242  
  243           pu blic long  getMaxUsed SpaceThres hold()
  244           {
  245                    retu rn this.ma xUsedSpace Threshold;
  246           }
  247  
  248           pu blic void  setMaxUsed SpaceThres hold(long  maxUsedSpa ceThreshol d)
  249           {
  250                    this .maxUsedSp aceThresho ld = maxUs edSpaceThr eshold;
  251           }
  252  
  253           /*  (non-Java doc)
  254            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.evicti on.Storage ThresholdE victionStr ategyMBean #setTarget FreeSpaceT hreshold(l ong)
  255            * /
  256           pu blic void  setTargetF reeSpaceTh reshold(lo ng targetF reeSpaceTh reshold)
  257           {
  258                    // t argetFreeS paceThresh old must b e positive
  259                    targ etFreeSpac eThreshold  = Math.ma x(targetFr eeSpaceThr eshold, 0L );
  260                    // t argetFreeS paceThresh old must b e greater  than or eq ual to the  minFreeSp aceThresho ld
  261                    targ etFreeSpac eThreshold  = Math.ma x(targetFr eeSpaceThr eshold, ge tMinFreeSp aceThresho ld());
  262                    
  263                    this .targetFre eSpaceThre shold = ta rgetFreeSp aceThresho ld;
  264                    logg er.info("S etting tar get free s pace thres hold to "  + this.tar getFreeSpa ceThreshol d);
  265           }
  266  
  267           pu blic Stora geThreshol dEvictionS trategyMem ento getMe mento()
  268           {
  269                    retu rn new Sto rageThresh oldEvictio nStrategyM emento(
  270                             getNam e(), isIni tialized()
  271                             getMin FreeSpaceT hreshold() , getTarge tFreeSpace Threshold( ), getMaxU sedSpaceTh reshold(),  
  272                             getDel ay(), getI nterval()
  273                    );
  274           }
  275           
  276           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ======
  277           //  The actua l sweep im plementati on, called  periodica lly
  278           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ======
  279           @O verride
  280           pu blic void  sweep()
  281           {
  282                    // a  list, one  element p er region,  each elem ent consis ting of a  list of gr oups to ev ict.
  283                    // b uilding th e list of  groups is  done by wo rker threa ds, one pe r region
  284                    List <Future<Ta rgetSizeGr oupPathSet >> regionS weepFuture s = new Ar rayList<Fu ture<Targe tSizeGroup PathSet>>( );
  285                    long  freeSpace  = -1;
  286                    Date Format df  = DateForm at.getDate TimeInstan ce();
  287                    long  totalMana gedSize =  0L;
  288                    
  289                    logg er.info( " Beginning  storage th reshold ev iction swe ep at " +  df.format( new Date() ) );
  290                    
  291                    Set< Region> re gions = ge tRegions() ;
  292                    
  293                    for( Region reg ion: getRe gions())
  294                             if( !  region.isI nitialized () )
  295                             {
  296                                      logger.w arn("Attem pt to star t an evict ion sweep  without al l regions  initialize d.  If thi s happens  once at st artup, the n it is ok ay.");
  297                                      return;
  298                             }
  299                    
  300                    if(r egions.isE mpty())
  301                             return ;
  302                    
  303                    Regi on firstRe gion = nul l;
  304                    // i f maxUsedS paceThresh old is > 0  then that  will be u sed as the  maximum
  305                    // e lse a log  message is  generated  and the e viction st ops
  306                    // T o get the  maximum us ed space r equires a  pass throu gh the cac he, and
  307                    // p erhaps a p ass throug h the file  system.
  308                    // T he freeSpa ce is eith er the act ual free s pace on th e device o r
  309                    // t he maxUsed SpaceThres hold - tot alManagedS ize
  310                    if(g etMaxUsedS paceThresh old() > 0)
  311                    {
  312                             for(Re gion regio n: getRegi ons())
  313                             {
  314                                      firstReg ion = (fir stRegion = = null ? r egion : fi rstRegion) ;
  315                                      totalMan agedSize + = region.g etUsedSpac e();
  316                             }
  317                             // how  much free  space foe s the regi on's persi stent stor age think  it has ava ilable
  318                             freeSp ace = firs tRegion.ge tFreeSpace ();
  319                             
  320                             // get  the minim um of the  persistent  persisten ce device  free space  or the
  321                             // "de fined" max imum space  minus the  actual us ed space.
  322                             // In  other word s the less er of what  we've def ined as th e minimum  free space  or the re al device  free space .
  323                             freeSp ace = Math .min(freeS pace, getM axUsedSpac eThreshold () - total ManagedSiz e);
  324                    }
  325                    else
  326                    {
  327                             // get  the first  region li nked to th is evictio n strategy
  328                             firstR egion = ge tRegions() .iterator( ).next();
  329  
  330                             // thi s may or m ay not wor k because  not all fi le systems  support i t.
  331                             // reg ions over  file syste ms that do  not suppo rt getting  free spac e
  332                             // MUS T report t he value a s 0
  333                             freeSp ace = firs tRegion.ge tFreeSpace ();
  334                    }
  335                    logR egionStati stics(firs tRegion, f reeSpace);
  336                    
  337                    // n ote that f reeSpace c ould be a  negative n umber
  338                    // i f it is pr ecisely 0L  and the m ax used sp ace is not  specified  
  339                    // t hen we can not contin ue
  340                    if(f reeSpace ! = 0L && ge tMaxUsedSp aceThresho ld() > 0)
  341                    {
  342                             // for  each Regi on
  343                             for(Re gion regio n: getRegi ons())
  344                             {
  345                                      // if th e free spa ce is less  than the  minimum th en start t he region  sweeps
  346                                      // else  don't
  347                                      // NOTE,  it is exp ected that  the regio n sweeps c ould be ex pensive so  running
  348                                      // them  should be  minimized
  349                                      if( free Space < ge tMinFreeSp aceThresho ld() )
  350                                      {
  351                                               // each re gion is to ld how man y bytes we  want to f ree up tot al
  352                                               // the can didates th at it prov ides are a ll tacked  onto a "ma ster" list
  353                                               // which i s used to  determine  what actua lly gets e victed
  354                                               RegionSwee pTask task  = new Reg ionSweepTa sk(region,  getTarget FreeSpaceT hreshold()  - freeSpa ce);
  355                                               Future<Tar getSizeGro upPathSet>  future =  getExecuto r().submit (task);
  356                                              
  357                                               regionSwee pFutures.a dd(future) ;
  358                                      }
  359                             }
  360                    }
  361                    else
  362                             logger .warn(
  363                                      "Managed  regions d o not supp ort free s pace repor ting and n o maximum  size was s pecified.   " + 
  364                                      " The ev iction str ategy is ' " + this.g etClass(). getSimpleN ame() + "' , which re quires it.   No evict ion will o ccur in th ese region s.");
  365  
  366                    // S tart the t hread to d o the actu al evictio ns.
  367                    // T his thread  will wait  until all  of the Fu tures have  results a vailable,  which is t he
  368                    // s ame as say ing when t he region  sweep task s are comp lete, then  it will e vict acros s
  369                    // a ll of the  regions su fficient t o free up  the target  space
  370                    getE xecutor(). execute( n ew Evictor Task(regio nSweepFutu res, getTa rgetFreeSp aceThresho ld() - fre eSpace) );
  371                    
  372                    retu rn;
  373           }
  374  
  375           pr ivate void  logRegion Statistics (Region re gion, long  freeSpace )
  376           {
  377                    logg er.info(
  378                             "Regio n '" + reg ion.getNam e() + 
  379                             "' has  " + freeS pace + 
  380                             " byte s free, ma ximum used  threshold  is " + ge tMaxUsedSp aceThresho ld() + 
  381                             " byte s free, mi nimum thre shold is "  + getMinF reeSpaceTh reshold() 
  382                             " byte s free, ta rget thres hold is "  + getTarge tFreeSpace Threshold( ) + 
  383                             " byte s free."
  384                    );
  385           }
  386           
  387           @O verride
  388           pu blic Sweep Statistics  getLastSw eepStatist ics()
  389           {
  390                    retu rn lastSwe epStatisti cs;
  391           }
  392           
  393           vo id setLast SweepStati stics(Swee pStatistic s sweepSta tistics)
  394           {
  395                    this .lastSweep Statistics  = sweepSt atistics;
  396           }
  397           
  398           @O verride
  399           pu blic Stora geThreshol dEvictionS trategyMem ento creat eMemento()
  400           {
  401                    Stor ageThresho ldEviction StrategyMe mento meme nto = new  StorageThr esholdEvic tionStrate gyMemento( );
  402                    
  403                    meme nto.setIni tialized(i sInitializ ed());
  404                    meme nto.setNam e(getName( ));
  405                    meme nto.setDel ay(getDela y());
  406                    meme nto.setInt erval(getI nterval()) ;
  407                    meme nto.setMin FreeSpaceT hreshold(g etMinFreeS paceThresh old());
  408                    meme nto.setTar getFreeSpa ceThreshol d(getTarge tFreeSpace Threshold( ));
  409                    meme nto.setMax UsedSpaceT hreshold(g etMaxUsedS paceThresh old());
  410                    
  411                    retu rn memento ;
  412           }
  413           
  414           
  415           /* *
  416            *  The worke r task tha t collects  the group s that may  be evicte d in one r egion.
  417            *  
  418              * @author        
BECKEC
  419            *
  420            * /
  421           cl ass Region SweepTask
  422           im plements C allable<Ta rgetSizeGr oupPathSet >
  423           {
  424                    priv ate Region  region;
  425                    priv ate long e victSize;
  426                    
  427                    Regi onSweepTas k(Region r egion, lon g evictSiz e)
  428                    {
  429                             this.r egion = re gion;
  430                             this.e victSize =  evictSize ;
  431                    }
  432                    
  433                    /**
  434                     * @ see java.u til.concur rent.Calla ble#call()
  435                     */
  436                    publ ic TargetS izeGroupPa thSet call () 
  437                    thro ws Excepti on
  438                    {
  439                             // mai ntains a S et of evic tion candi dates in o ldest to n ewest orde r
  440                             // and  whose tot al size is  less than  the evict Size
  441                             Target SizeGroupP athSet evi ctionCandi dates = ne w TargetSi zeGroupPat hSet(evict Size);
  442                             logger .info(
  443                                      "Region  '" + regio n.getName( ) + 
  444                                      " bytes  free, mini mum thresh old is " +  getMinFre eSpaceThre shold() + 
  445                                      " bytes  free, targ et thresho ld is " +  getTargetF reeSpaceTh reshold()  + " bytes  free."
  446                             );
  447                             
  448                             // spe cial case  if the Reg ion implem entation d oes not re port free  space
  449                             if(evi ctSize > 0 )
  450                             {
  451                                      // scan  leaf nodes  first !!!
  452                                      // the g roup visit or does no t provide  ancestry i nformation
  453                                      // DO NO T SCAN ANY THING BUT  LEAF NODES , otherwis e the calc ulated siz es will be  incorrect
  454                                      TargetSi zeGroupPat hSet regio nEvictionC andidates 
  455                                               GroupEvict ionCandida teVisitor. createAndR un(region,  false, tr ue, evictS ize);
  456                                      eviction Candidates .addAll( r egionEvict ionCandida tes );
  457                             }
  458                             
  459                             return  evictionC andidates;
  460                    }
  461           }
  462           
  463           /* *
  464            *  A task th at 
  465            *  1.) Colle cts the re sult from  all the re gions and  combines t hem
  466            *      into  a single l ist of gro ups to be  evicted.   The collec tive
  467            *      size  of the gro ups on the  list will  be no big ger than t he target
  468            *      size.
  469            *  2.) 
  470            *  
  471              * @author        
BECKEC
  472            * /
  473           cl ass Evicto rTask
  474           im plements R unnable
  475           {
  476                    priv ate List<F uture<Targ etSizeGrou pPathSet>>  regionTas kFutures;
  477                    priv ate Target SizeGroupP athSet evi ctableGrou ps;
  478                    
  479                    Evic torTask(Li st<Future< TargetSize GroupPathS et>> regio nTaskFutur es, long s ize)
  480                    {
  481                             this.r egionTaskF utures = r egionTaskF utures;
  482                             evicta bleGroups  = new Targ etSizeGrou pPathSet(s ize);
  483                    }
  484                    
  485                    /**
  486                     * 
  487                     */
  488                    publ ic void ru n()
  489                    {
  490                             long s tart = Sys tem.curren tTimeMilli s();
  491                             int gr oupsEvicte d = 0;
  492                             
  493                             for(Fu ture<Targe tSizeGroup PathSet> f uture : th is.regionT askFutures )
  494                             {
  495                                      try
  496                                      {
  497                                               // get() -  Waits if  necessary  for the co mputation  to complet e, and the n retrieve s its resu lt.
  498                                               TargetSize GroupPathS et deletab leGroupPat hs = futur e.get();
  499                                               evictableG roups.addA ll( deleta bleGroupPa ths );
  500                                      } 
  501                                      catch (I nterrupted Exception  x)
  502                                      {
  503                                               logger.war n("Interru ptedExcept ion caught  in region  eviction  thread whi le getting  result.",  x);
  504                                      } 
  505                                      catch (E xecutionEx ception x)
  506                                      {
  507                                               logger.war n("Executi onExceptio n caught i n region e viction th read while  getting r esult. At  least one  region has  not contr ibuted to  evictable  list.", x) ;
  508                                      }
  509                             }
  510                             
  511                             logger .info("The re are " +  evictable Groups.siz e() + " ca che entrie s to evict .");
  512                             if(evi ctableGrou ps.size()  > 0)
  513                             {
  514                                      for( Gro upPath gro upPath:evi ctableGrou ps )
  515                                      {
  516                                               try
  517                                               {
  518                                                       Gr oup parent  = groupPa th.getRegi on().getGr oup(groupP ath.getPat hName());
  519                                                       if (parent ==  null)
  520                                                                grou pPath.getR egion().de leteChildG roup(group Path.getGr oup(), fal se);
  521                                                       el se
  522                                                                pare nt.deleteC hildGroup( groupPath. getGroup() , false);
  523                                                                
  524                                                       ++ groupsEvic ted;
  525                                              
  526                                               catch (Cac heExceptio n x)
  527                                               {
  528                                                       lo gger.error ("Unable t o remove g roup '" +  groupPath. getGroup() .getName()  + "'", x) ;
  529                                               }
  530                                      }
  531                             }
  532                             
  533                             setLas tSweepStat istics(new  SweepStat istics(sta rt, groups Evicted) ) ;
  534                    }
  535           }
  536   }