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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\util | GroupVisitor.java | Mon Dec 4 21:35:22 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\util | GroupVisitor.java | Mon Dec 4 21:57:26 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 352 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging.sto rage.cache .util; | |
| 5 | ||
| 6 | import gov .va.med.im aging.stor age.cache. Group; | |
| 7 | import gov .va.med.im aging.stor age.cache. Region; | |
| 8 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
| 9 | ||
| 10 | import jav a.util.Arr ayList; | |
| 11 | import jav a.util.Con currentMod ificationE xception; | |
| 12 | import jav a.util.Ite rator; | |
| 13 | import jav a.util.Lis t; | |
| 14 | ||
| 15 | import org .apache.lo gging.log4 j.LogManag er; | |
| 16 | import org .apache.lo gging.log4 j.Logger; | |
| 17 | ||
| 18 | /** | |
| 19 | * This cl ass implem ents a dep th-first t raversal o ver all of the group s in a Reg ion. | |
| 20 | * For eac h Group vi sited, the groupVisi t() method is called , derived classes | |
| 21 | * should do somethi ng useful in that me thod. | |
| 22 | * | |
| 23 | * Note th at this cl ass implem ents Runna ble and ma y therefor e be run o n | |
| 24 | * a seper ate thread . It may also be ru n on the c alling thr ead by cal ling | |
| 25 | * the run () method directly. This clas s is threa d-safe in that it ma y run in | |
| 26 | * either mode. Mul tiple call s to run() from diff erent thre ads are di scouraged | |
| 27 | * , subse quent call s will wai t for the first call to comple te. | |
| 28 | * | |
| 29 | * @author
|
|
| 30 | * | |
| 31 | */ | |
| 32 | public abs tract clas s GroupVis itor | |
| 33 | implements Runnable | |
| 34 | { | |
| 35 | pr ivate fina l Logger l ogger = Lo gManager.g etLogger(t his.getCla ss()); | |
| 36 | pr ivate fina l Region r egion; | |
| 37 | pr ivate fina l boolean includeLea fNodes; | |
| 38 | pr ivate fina l boolean includeBra nchNodes; | |
| 39 | pr ivate fina l boolean lockRegion s; | |
| 40 | ||
| 41 | /* * | |
| 42 | * Create a GroupVisit or over th e given re gion, spec ifying whe ther to in clude | |
| 43 | * branch no des or lea f nodes. If include BranchNode s is true then Group instances | |
| 44 | * that have at least one child Group will be includ ed. If in cludeLeafN odes is tr ue | |
| 45 | * then Grou p instance s that do not have a ny child G roups will be includ ed. | |
| 46 | * | |
| 47 | * @param re gion | |
| 48 | * @param in cludeBranc hNodes | |
| 49 | * @param in cludeLeafN odes | |
| 50 | * @param lo ckRegions | |
| 51 | * / | |
| 52 | pu blic Group Visitor(Re gion regio n, boolean includeBr anchNodes, boolean i ncludeLeaf Nodes, boo lean lockR egions) | |
| 53 | { | |
| 54 | this .region = region; | |
| 55 | this .includeBr anchNodes = includeB ranchNodes ; | |
| 56 | this .includeLe afNodes = includeLea fNodes; | |
| 57 | this .lockRegio ns = lockR egions; | |
| 58 | } | |
| 59 | ||
| 60 | pu blic Group Visitor(Re gion regio n, boolean includeBr anchNodes, boolean i ncludeLeaf Nodes) | |
| 61 | { | |
| 62 | this (region, i ncludeBran chNodes, i ncludeLeaf Nodes, fal se); | |
| 63 | } | |
| 64 | ||
| 65 | pu blic Regio n getRegio n() | |
| 66 | { | |
| 67 | retu rn this.re gion; | |
| 68 | } | |
| 69 | ||
| 70 | pu blic boole an isInclu deBranchNo des() | |
| 71 | { | |
| 72 | retu rn this.in cludeBranc hNodes; | |
| 73 | } | |
| 74 | ||
| 75 | pu blic boole an isInclu deLeafNode s() | |
| 76 | { | |
| 77 | retu rn this.in cludeLeafN odes; | |
| 78 | } | |
| 79 | ||
| 80 | pu blic synch ronized vo id run() | |
| 81 | { | |
| 82 | // s anity chec k | |
| 83 | if(! isIncludeB ranchNodes () && ! is IncludeLea fNodes()) | |
| 84 | return ; | |
| 85 | ||
| 86 | try | |
| 87 | { | |
| 88 | if(loc kRegions) | |
| 89 | { | |
| 90 | synchron ized (regi on) | |
| 91 | { | |
| 92 | Iterator<? extends G roup> gro upIter = r egion.getG roups(); | |
| 93 | traverseGr oups(new A rrayList<G roup>(), g roupIter); | |
| 94 | } | |
| 95 | } | |
| 96 | else | |
| 97 | { | |
| 98 | try | |
| 99 | { | |
| 100 | Iterator<? extends G roup> gro upIter = r egion.getG roups(); | |
| 101 | traverseGr oups(new A rrayList<G roup>(), g roupIter); | |
| 102 | } | |
| 103 | catch (C oncurrentM odificatio nException cmX) | |
| 104 | { | |
| 105 | cmX.printS tackTrace( ); | |
| 106 | } | |
| 107 | } | |
| 108 | } | |
| 109 | catc h (CacheEx ception x) | |
| 110 | { | |
| 111 | x.prin tStackTrac e(); | |
| 112 | } | |
| 113 | } | |
| 114 | ||
| 115 | /* * | |
| 116 | * @param gr oupIter | |
| 117 | * @throws C acheExcept ion | |
| 118 | * / | |
| 119 | pr ivate void traverseG roups(List <Group> pa th, Iterat or<? exten ds Group> groupIter) | |
| 120 | th rows Cache Exception | |
| 121 | { | |
| 122 | if(g roupIter = = null) | |
| 123 | return ; | |
| 124 | ||
| 125 | whil e( groupIt er.hasNext () ) | |
| 126 | { | |
| 127 | Group group = nu ll; | |
| 128 | try | |
| 129 | { | |
| 130 | group = groupIter. next(); | |
| 131 | } | |
| 132 | catch (Concurren tModificat ionExcepti on cmX) | |
| 133 | { | |
| 134 | logger.w arn("Unabl e to trave rse groups , probably during an eviction pass."); | |
| 135 | break; | |
| 136 | } | |
| 137 | ||
| 138 | // if both branc h and leaf nodes are requested then | |
| 139 | // don 't bother checking t he existen ce of chil d groups, | |
| 140 | // whi ch can be an expensi ve operati on | |
| 141 | if( is IncludeBra nchNodes() && isIncl udeLeafNod es() ) | |
| 142 | { | |
| 143 | try{grou pVisit(thi s.getRegio n(), path, group);} | |
| 144 | catch(Ex ception x) {x.printSt ackTrace() ;} | |
| 145 | } | |
| 146 | else | |
| 147 | { | |
| 148 | // do th is once fo r efficien cy (getGro ups can be expensive ) | |
| 149 | boolean groupHasCh ildGroups = group.ge tGroups(). hasNext(); | |
| 150 | ||
| 151 | // if in clude bran ch nodes a nd the gro up has chi ld groups | |
| 152 | if(isInc ludeBranch Nodes() && groupHasC hildGroups ) | |
| 153 | { | |
| 154 | try{groupV isit(this. getRegion( ), path, g roup);} | |
| 155 | catch(Exce ption x){x .printStac kTrace();} | |
| 156 | } | |
| 157 | // if in clude leaf nodes and the group does not have child groups | |
| 158 | else if( isIncludeL eafNodes() && !group HasChildGr oups) | |
| 159 | { | |
| 160 | try{groupV isit(this. getRegion( ), path, g roup);} | |
| 161 | catch(Exce ption x){x .printStac kTrace();} | |
| 162 | } | |
| 163 | } | |
| 164 | ||
| 165 | List<G roup> curr entPath = new ArrayL ist<Group> (); | |
| 166 | curren tPath.addA ll(path); | |
| 167 | curren tPath.add( group); | |
| 168 | ||
| 169 | // rec ursively c all ouselv es to trav erse our a ncestors | |
| 170 | traver seGroups( currentPat h, group.g etGroups() ); | |
| 171 | } | |
| 172 | } | |
| 173 | ||
| 174 | ||
| 175 | pu blic abstr act void g roupVisit( Region reg ion, List< Group> pat h, Group g roup) | |
| 176 | th rows Excep tion; | |
| 177 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.