Produced by Araxis Merge on 3/25/2019 8:58:02 AM Central Daylight 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 | C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSServiceCache.java | Mon Mar 18 20:39:09 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSServiceCache.java | Tue Mar 19 12:03:48 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 4 | 460 |
Changed | 3 | 6 |
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 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: May 7, 2008 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: DN S WERFEJ | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.pro xy.ids; | |
27 | ||
28 | import jav a.util.Set ; | |
29 | ||
30 | import gov .va.med.im aging.exch ange.BaseT imedCache; | |
31 | import gov .va.med.im aging.exch ange.BaseT imedCacheV alueItem; | |
32 | import gov .va.med.im aging.exch ange.TaskS cheduler; | |
33 | ||
34 | /** | |
35 | * Cache t o hold ins tances of the IDS se rvice for a specifie d amount o f time, | |
36 | * then th ey are pur ged | |
37 | * | |
38 | * @author DN S WERFEJ | |
39 | * | |
40 | */ | |
41 | public cla ss IDSServ iceCache | |
42 | { | |
43 | pr ivate fina l static l ong IDS_SE RVICE_CACH E_TIMER_RE FRESH = 10 00 * 60 * 15; // 15 minutes | |
44 | pr ivate fina l static l ong IDS_SE RVICE_SITE _OFFLINE_R EFRESH = 1 000 * 60 * 10; // 10 minutes | |
45 | ||
46 | pr ivate Base TimedCache <String, I DSServiceC acheItem> serviceCac he = null; | |
47 | pr ivate Base TimedCache <String, I DSSiteOffl ineCacheIt em> siteOf flineCache = null; | |
48 | pr ivate Base TimedCache <String, I DSSiteVers ionUnavail ableCacheI tem> siteV ersionUnav ailableCac he = null; | |
49 | ||
50 | pu blic IDSSe rviceCache () | |
51 | { | |
52 | serv iceCache = new BaseT imedCache< String, ID SServiceCa cheItem>(I DSServiceC ache.class .toString( )); | |
53 | Task Scheduler. getTaskSch eduler().s chedule(se rviceCache , IDS_SERV ICE_CACHE_ TIMER_REFR ESH, | |
54 | IDS_SERV ICE_CACHE_ TIMER_REFR ESH); | |
55 | ||
56 | site OfflineCac he = new B aseTimedCa che<String , IDSSiteO fflineCach eItem>(IDS ServiceCac he.class.t oString()) ; | |
57 | site OfflineCac he.setRete ntionPerio d(IDS_SERV ICE_SITE_O FFLINE_REF RESH); | |
58 | Task Scheduler. getTaskSch eduler().s chedule(si teOfflineC ache, IDS_ SERVICE_SI TE_OFFLINE _REFRESH, | |
59 | IDS_SERV ICE_SITE_O FFLINE_REF RESH); | |
60 | ||
61 | site VersionUna vailableCa che = new BaseTimedC ache<Strin g, IDSSite VersionUna vailableCa cheItem>(I DSServiceC ache.class .toString( )); | |
62 | site VersionUna vailableCa che.setRet entionPeri od(IDS_SER VICE_SITE_ OFFLINE_RE FRESH); | |
63 | Task Scheduler. getTaskSch eduler().s chedule(si teVersionU navailable Cache, IDS _SERVICE_S ITE_OFFLIN E_REFRESH, | |
64 | IDS_SERV ICE_SITE_O FFLINE_REF RESH); | |
65 | } | |
66 | ||
67 | pu blic boole an isSiteV ersionUnav ailable(St ring siteN umber, Str ing versio n, String applicatio nName) | |
68 | { | |
69 | IDSS iteVersion Unavailabl eCacheItem item = nu ll; | |
70 | sync hronized(s iteVersion Unavailabl eCache) | |
71 | { | |
72 | String key = cre ateSiteVer sionUnavai lableKey(s iteNumber, version, applicatio nName); | |
73 | item = (IDSSiteV ersionUnav ailableCac heItem)sit eVersionUn availableC ache.getIt em(key); | |
74 | } | |
75 | if(i tem != nul l) | |
76 | return true; | |
77 | retu rn false; | |
78 | } | |
79 | ||
80 | pu blic void setSiteVer sionUnavai lable(Stri ng siteNum ber, Strin g version, String ap plicationN ame) | |
81 | { | |
82 | IDSS iteVersion Unavailabl eCacheItem item = | |
83 | new ID SSiteVersi onUnavaila bleCacheIt em(siteNum ber, versi on, applic ationName) ; | |
84 | sync hronized ( siteVersio nUnavailab leCache) | |
85 | { | |
86 | siteVe rsionUnava ilableCach e.updateIt em(item); | |
87 | } | |
88 | } | |
89 | ||
90 | pu blic boole an isSiteO ffline(Str ing siteNu mber) | |
91 | { | |
92 | IDSS iteOffline CacheItem item = nul l; | |
93 | sync hronized(s iteOffline Cache) | |
94 | { | |
95 | item = (IDSSiteO fflineCach eItem)site OfflineCac he.getItem (siteNumbe r); | |
96 | } | |
97 | if(i tem != nul l) | |
98 | return true; | |
99 | retu rn false; | |
100 | } | |
101 | ||
102 | pu blic void setSiteOff line(Strin g siteNumb er) | |
103 | { | |
104 | IDSS iteOffline CacheItem item = new IDSSiteOf flineCache Item(siteN umber); | |
105 | sync hronized(s iteOffline Cache) | |
106 | { | |
107 | siteOf flineCache .updateIte m(item); | |
108 | } | |
109 | } | |
110 | ||
111 | /* * | |
112 | * Return an IDS servi ce instanc e from the cache | |
113 | * @param si teNumber T he site nu mber of th e service looking up | |
114 | * @param ap plicationT ype The ap plication type to fi nd | |
115 | * @param ve rsion The version of the servi ce to find | |
116 | * @return T he IDS Ser vice insta nce from t he cache o r null if none was f ound that match the input | |
117 | * / | |
118 | pu blic IDSSe rvice getC achedServi ce(String siteNumber , String a pplication Type, Stri ng version ) | |
119 | { | |
120 | sync hronized(s erviceCach e) | |
121 | { | |
122 | if(ser viceCache == null) | |
123 | return n ull; | |
124 | String key = sit eNumber + "_" + appl icationTyp e + "_" + version; | |
125 | IDSSer viceCacheI tem item = (IDSServi ceCacheIte m) service Cache.getI tem(key); | |
126 | if(ite m == null) | |
127 | return n ull; | |
128 | return item.serv ice; | |
129 | } | |
130 | } | |
131 | ||
132 | /* * | |
133 | * Cache an IDS servic e instance | |
134 | * @param si teNumber T he site nu mber for w here the s ervice cam e from | |
135 | * @param se rvice The service to cache | |
136 | * / | |
137 | pu blic void cacheServi ce(String siteNumber , IDSServi ce service ) | |
138 | { | |
139 | sync hronized(s erviceCach e) | |
140 | { | |
141 | IDSSer viceCacheI tem item = new IDSSe rviceCache Item(siteN umber, ser vice); | |
142 | servic eCache.upd ateItem(it em); | |
143 | } | |
144 | } | |
145 | ||
146 | /* * | |
147 | * Cache a s et of IDS services | |
148 | * @param si teNumber T he site nu mber for w here all o f the serv ices came from | |
149 | * @param se rvices The services to cache | |
150 | * / | |
151 | pu blic void cacheServi ces(String siteNumbe r, Set<IDS Service> s ervices) | |
152 | { | |
153 | for( IDSService service : services) | |
154 | { | |
155 | cacheS ervice(sit eNumber, s ervice); | |
156 | } | |
157 | } | |
158 | ||
159 | /* * | |
160 | * Instances to hold t he IDS Ser vices with the prope r key so t he cache c an find th em | |
161 | * @author DN S WERFEJ | |
162 | * | |
163 | * / | |
164 | cl ass IDSSer viceCacheI tem extend s BaseTime dCacheValu eItem | |
165 | { | |
166 | priv ate String siteNumbe r; | |
167 | priv ate IDSSer vice servi ce; | |
168 | ||
169 | /** | |
170 | * C reate a ID S Service cache item | |
171 | * @ param site Number | |
172 | * @ param serv ice | |
173 | */ | |
174 | publ ic IDSServ iceCacheIt em(String siteNumber , IDSServi ce service ) | |
175 | { | |
176 | super( ); | |
177 | this.s iteNumber = siteNumb er; | |
178 | this.s ervice = s ervice; | |
179 | } | |
180 | ||
181 | @Ove rride | |
182 | publ ic Object getKey() | |
183 | { | |
184 | return siteNumbe r + "_" + service.ge tApplicati onType() + "_" + ser vice.getVe rsion(); | |
185 | } | |
186 | ||
187 | } | |
188 | ||
189 | cl ass IDSSit eOfflineCa cheItem | |
190 | ex tends Base TimedCache ValueItem | |
191 | { | |
192 | priv ate String siteNumbe r; | |
193 | ||
194 | publ ic IDSSite OfflineCac heItem(Str ing siteNu mber) | |
195 | { | |
196 | super( ); | |
197 | this.s iteNumber = siteNumb er; | |
198 | } | |
199 | ||
200 | @Ove rride | |
201 | publ ic Object getKey() | |
202 | { | |
203 | return siteNumbe r; | |
204 | } | |
205 | } | |
206 | ||
207 | cl ass IDSSit eVersionUn availableC acheItem | |
208 | ex tends Base TimedCache ValueItem | |
209 | { | |
210 | priv ate final String sit eNumber; | |
211 | priv ate final String ver sion; | |
212 | priv ate final String app licationNa me; | |
213 | ||
214 | publ ic IDSSite VersionUna vailableCa cheItem(St ring siteN umber, Str ing versio n, String applicatio nName) | |
215 | { | |
216 | this.s iteNumber = siteNumb er; | |
217 | this.v ersion = v ersion; | |
218 | this.a pplication Name = app licationNa me; | |
219 | } | |
220 | ||
221 | @Ove rride | |
222 | publ ic Object getKey() | |
223 | { | |
224 | return createSit eVersionUn availableK ey(siteNum ber, versi on, applic ationName) ; | |
225 | } | |
226 | ||
227 | } | |
228 | ||
229 | st atic Strin g createSi teVersionU navailable Key(String siteNumbe r, String version, S tring appl icationNam e) | |
230 | { | |
231 | retu rn siteNum ber + "_" + version + "_" + ap plicationN ame; | |
232 | } | |
233 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.