1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| package com.opensymphony.oscache.web; |
6 |
| |
7 |
| import com.opensymphony.oscache.base.*; |
8 |
| import com.opensymphony.oscache.base.events.CacheEventListener; |
9 |
| import com.opensymphony.oscache.base.events.ScopeEvent; |
10 |
| import com.opensymphony.oscache.base.events.ScopeEventListener; |
11 |
| import com.opensymphony.oscache.base.events.ScopeEventType; |
12 |
| |
13 |
| import org.apache.commons.logging.Log; |
14 |
| import org.apache.commons.logging.LogFactory; |
15 |
| |
16 |
| import java.io.Serializable; |
17 |
| |
18 |
| import java.util.*; |
19 |
| |
20 |
| import javax.servlet.ServletContext; |
21 |
| import javax.servlet.http.HttpServletRequest; |
22 |
| import javax.servlet.http.HttpSession; |
23 |
| import javax.servlet.jsp.PageContext; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| public class ServletCacheAdministrator extends AbstractCacheAdministrator implements Serializable { |
42 |
| private static final transient Log log = LogFactory.getLog(ServletCacheAdministrator.class); |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| private final static String CACHE_USE_HOST_DOMAIN_KEY = "cache.use.host.domain.in.key"; |
48 |
| private final static String CACHE_KEY_KEY = "cache.key"; |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| private final static String DEFAULT_CACHE_KEY = "__oscache_cache"; |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
| public final static String SESSION_SCOPE_NAME = "session"; |
59 |
| public final static String APPLICATION_SCOPE_NAME = "application"; |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
| private final static String CACHE_ADMINISTRATOR_KEY = "__oscache_admin"; |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| public final static String HASH_KEY_SCOPE = "scope"; |
72 |
| |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| public final static String HASH_KEY_SESSION_ID = "sessionId"; |
79 |
| |
80 |
| |
81 |
| |
82 |
| |
83 |
| |
84 |
| |
85 |
| public final static String HASH_KEY_CONTEXT_TMPDIR = "context.tempdir"; |
86 |
| |
87 |
| |
88 |
| |
89 |
| |
90 |
| private final static String FILE_SEPARATOR = "/"; |
91 |
| |
92 |
| |
93 |
| |
94 |
| |
95 |
| private final static char FILE_SEPARATOR_CHAR = FILE_SEPARATOR.charAt(0); |
96 |
| |
97 |
| |
98 |
| |
99 |
| |
100 |
| private final static short AVERAGE_KEY_LENGTH = 30; |
101 |
| |
102 |
| |
103 |
| |
104 |
| |
105 |
| private static final String m_strBase64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
106 |
| |
107 |
| |
108 |
| |
109 |
| |
110 |
| private Map flushTimes; |
111 |
| |
112 |
| |
113 |
| |
114 |
| |
115 |
| private transient ServletContext context; |
116 |
| |
117 |
| |
118 |
| |
119 |
| |
120 |
| private String cacheKey; |
121 |
| |
122 |
| |
123 |
| |
124 |
| |
125 |
| |
126 |
| private boolean useHostDomainInKey = false; |
127 |
| |
128 |
| |
129 |
| |
130 |
| |
131 |
| |
132 |
| |
133 |
0
| private ServletCacheAdministrator(ServletContext context, Properties p) {
|
134 |
0
| super(p);
|
135 |
0
| config.set(HASH_KEY_CONTEXT_TMPDIR, context.getAttribute("javax.servlet.context.tempdir"));
|
136 |
| |
137 |
0
| flushTimes = new HashMap();
|
138 |
0
| initHostDomainInKey();
|
139 |
0
| this.context = context;
|
140 |
| } |
141 |
| |
142 |
| |
143 |
| |
144 |
| |
145 |
| |
146 |
| |
147 |
| |
148 |
0
| public static ServletCacheAdministrator getInstance(ServletContext context) {
|
149 |
0
| return getInstance(context, null);
|
150 |
| } |
151 |
| |
152 |
| |
153 |
| |
154 |
| |
155 |
| |
156 |
| |
157 |
| |
158 |
| |
159 |
| |
160 |
| |
161 |
| |
162 |
0
| public synchronized static ServletCacheAdministrator getInstance(ServletContext context, Properties p) {
|
163 |
| |
164 |
0
| ServletCacheAdministrator admin = (ServletCacheAdministrator) context.getAttribute(CACHE_ADMINISTRATOR_KEY);
|
165 |
| |
166 |
| |
167 |
| |
168 |
0
| if (admin == null) {
|
169 |
0
| admin = new ServletCacheAdministrator(context, p);
|
170 |
0
| context.setAttribute(CACHE_ADMINISTRATOR_KEY, admin);
|
171 |
| |
172 |
0
| if (log.isInfoEnabled()) {
|
173 |
0
| log.info("Created new instance of ServletCacheAdministrator");
|
174 |
| } |
175 |
| |
176 |
0
| admin.getAppScopeCache(context);
|
177 |
| } |
178 |
| |
179 |
0
| if (admin.context == null) {
|
180 |
0
| admin.context = context;
|
181 |
| } |
182 |
| |
183 |
0
| return admin;
|
184 |
| } |
185 |
| |
186 |
| |
187 |
| |
188 |
| |
189 |
| |
190 |
0
| public static void destroyInstance(ServletContext context) {
|
191 |
0
| ServletCacheAdministrator admin;
|
192 |
0
| admin = (ServletCacheAdministrator) context.getAttribute(CACHE_ADMINISTRATOR_KEY);
|
193 |
| |
194 |
0
| if (admin != null) {
|
195 |
| |
196 |
0
| Cache cache = (Cache) context.getAttribute(admin.getCacheKey());
|
197 |
| |
198 |
0
| if (cache != null) {
|
199 |
0
| admin.finalizeListeners(cache);
|
200 |
0
| context.removeAttribute(admin.getCacheKey());
|
201 |
0
| context.removeAttribute(CACHE_ADMINISTRATOR_KEY);
|
202 |
0
| cache = null;
|
203 |
| |
204 |
0
| if (log.isInfoEnabled()) {
|
205 |
0
| log.info("Shut down the ServletCacheAdministrator");
|
206 |
| } |
207 |
| } |
208 |
| |
209 |
0
| admin = null;
|
210 |
| } |
211 |
| } |
212 |
| |
213 |
| |
214 |
| |
215 |
| |
216 |
| |
217 |
| |
218 |
| |
219 |
| |
220 |
| |
221 |
0
| public Cache getCache(HttpServletRequest request, int scope) {
|
222 |
0
| if (scope == PageContext.APPLICATION_SCOPE) {
|
223 |
0
| return getAppScopeCache(context);
|
224 |
| } |
225 |
| |
226 |
0
| if (scope == PageContext.SESSION_SCOPE) {
|
227 |
0
| return getSessionScopeCache(request.getSession(true));
|
228 |
| } |
229 |
| |
230 |
0
| throw new RuntimeException("The supplied scope value of " + scope + " is invalid. Acceptable values are PageContext.APPLICATION_SCOPE and PageContext.SESSION_SCOPE");
|
231 |
| } |
232 |
| |
233 |
| |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
| |
240 |
0
| public Cache getAppScopeCache(ServletContext context) {
|
241 |
0
| Cache cache;
|
242 |
0
| Object obj = context.getAttribute(getCacheKey());
|
243 |
| |
244 |
0
| if ((obj == null) || !(obj instanceof Cache)) {
|
245 |
0
| if (log.isInfoEnabled()) {
|
246 |
0
| log.info("Created new application-scoped cache at key: " + getCacheKey());
|
247 |
| } |
248 |
| |
249 |
0
| cache = createCache(PageContext.APPLICATION_SCOPE, null);
|
250 |
0
| context.setAttribute(getCacheKey(), cache);
|
251 |
| } else { |
252 |
0
| cache = (Cache) obj;
|
253 |
| } |
254 |
| |
255 |
0
| return cache;
|
256 |
| } |
257 |
| |
258 |
| |
259 |
| |
260 |
| |
261 |
| |
262 |
| |
263 |
| |
264 |
| |
265 |
0
| public Cache getSessionScopeCache(HttpSession session) {
|
266 |
0
| Cache cache;
|
267 |
0
| Object obj = session.getAttribute(getCacheKey());
|
268 |
| |
269 |
0
| if ((obj == null) || !(obj instanceof Cache)) {
|
270 |
0
| if (log.isInfoEnabled()) {
|
271 |
0
| log.info("Created new session-scoped cache in session " + session.getId() + " at key: " + getCacheKey());
|
272 |
| } |
273 |
| |
274 |
0
| cache = createCache(PageContext.SESSION_SCOPE, session.getId());
|
275 |
0
| session.setAttribute(getCacheKey(), cache);
|
276 |
| } else { |
277 |
0
| cache = (Cache) obj;
|
278 |
| } |
279 |
| |
280 |
0
| return cache;
|
281 |
| } |
282 |
| |
283 |
| |
284 |
| |
285 |
| |
286 |
| |
287 |
| |
288 |
| |
289 |
0
| public String getCacheKey() {
|
290 |
0
| if (cacheKey == null) {
|
291 |
0
| cacheKey = getProperty(CACHE_KEY_KEY);
|
292 |
| |
293 |
0
| if (cacheKey == null) {
|
294 |
0
| cacheKey = DEFAULT_CACHE_KEY;
|
295 |
| } |
296 |
| } |
297 |
| |
298 |
0
| return cacheKey;
|
299 |
| } |
300 |
| |
301 |
| |
302 |
| |
303 |
| |
304 |
| |
305 |
| |
306 |
| |
307 |
0
| public void setFlushTime(Date date, int scope) {
|
308 |
0
| if (log.isInfoEnabled()) {
|
309 |
0
| log.info("Flushing scope " + scope + " at " + date);
|
310 |
| } |
311 |
| |
312 |
0
| synchronized (flushTimes) {
|
313 |
0
| if (date != null) {
|
314 |
| |
315 |
0
| dispatchScopeEvent(ScopeEventType.SCOPE_FLUSHED, scope, date, null);
|
316 |
0
| flushTimes.put(new Integer(scope), date);
|
317 |
| } else { |
318 |
0
| logError("setFlushTime called with a null date.");
|
319 |
0
| throw new IllegalArgumentException("setFlushTime called with a null date.");
|
320 |
| } |
321 |
| } |
322 |
| } |
323 |
| |
324 |
| |
325 |
| |
326 |
| |
327 |
| |
328 |
| |
329 |
0
| public void setFlushTime(int scope) {
|
330 |
0
| setFlushTime(new Date(), scope);
|
331 |
| } |
332 |
| |
333 |
| |
334 |
| |
335 |
| |
336 |
| |
337 |
| |
338 |
| |
339 |
| |
340 |
0
| public Date getFlushTime(int scope) {
|
341 |
0
| synchronized (flushTimes) {
|
342 |
0
| return (Date) flushTimes.get(new Integer(scope));
|
343 |
| } |
344 |
| } |
345 |
| |
346 |
| |
347 |
| |
348 |
| |
349 |
| |
350 |
| |
351 |
| |
352 |
| |
353 |
| |
354 |
| |
355 |
| |
356 |
0
| public Object getFromCache(int scope, HttpServletRequest request, String key, int refreshPeriod) throws NeedsRefreshException {
|
357 |
0
| Cache cache = getCache(request, scope);
|
358 |
0
| key = this.generateEntryKey(key, request, scope);
|
359 |
0
| return cache.getFromCache(key, refreshPeriod);
|
360 |
| } |
361 |
| |
362 |
| |
363 |
| |
364 |
| |
365 |
| |
366 |
| |
367 |
| |
368 |
| |
369 |
| |
370 |
| |
371 |
0
| public boolean isScopeFlushed(CacheEntry cacheEntry, int scope) {
|
372 |
0
| Date flushDateTime = getFlushTime(scope);
|
373 |
| |
374 |
0
| if (flushDateTime != null) {
|
375 |
0
| long lastUpdate = cacheEntry.getLastUpdate();
|
376 |
0
| return (flushDateTime.getTime() >= lastUpdate);
|
377 |
| } else { |
378 |
0
| return false;
|
379 |
| } |
380 |
| } |
381 |
| |
382 |
| |
383 |
| |
384 |
| |
385 |
| |
386 |
| |
387 |
0
| public void addScopeEventListener(ScopeEventListener listener) {
|
388 |
0
| listenerList.add(ScopeEventListener.class, listener);
|
389 |
| } |
390 |
| |
391 |
| |
392 |
| |
393 |
| |
394 |
| |
395 |
| |
396 |
| |
397 |
| |
398 |
| |
399 |
| |
400 |
0
| public void cancelUpdate(int scope, HttpServletRequest request, String key) {
|
401 |
0
| Cache cache = getCache(request, scope);
|
402 |
0
| key = this.generateEntryKey(key, request, scope);
|
403 |
0
| cache.cancelUpdate(key);
|
404 |
| } |
405 |
| |
406 |
| |
407 |
| |
408 |
| |
409 |
| |
410 |
| |
411 |
0
| public void flushAll(Date date) {
|
412 |
0
| synchronized (flushTimes) {
|
413 |
0
| setFlushTime(date, PageContext.APPLICATION_SCOPE);
|
414 |
0
| setFlushTime(date, PageContext.SESSION_SCOPE);
|
415 |
0
| setFlushTime(date, PageContext.REQUEST_SCOPE);
|
416 |
0
| setFlushTime(date, PageContext.PAGE_SCOPE);
|
417 |
| } |
418 |
| |
419 |
| |
420 |
0
| dispatchScopeEvent(ScopeEventType.ALL_SCOPES_FLUSHED, -1, date, null);
|
421 |
| } |
422 |
| |
423 |
| |
424 |
| |
425 |
| |
426 |
0
| public void flushAll() {
|
427 |
0
| flushAll(new Date());
|
428 |
| } |
429 |
| |
430 |
| |
431 |
| |
432 |
| |
433 |
| |
434 |
| |
435 |
| |
436 |
| |
437 |
| |
438 |
| |
439 |
| |
440 |
| |
441 |
| |
442 |
| |
443 |
| |
444 |
| |
445 |
| |
446 |
| |
447 |
0
| public String generateEntryKey(String key, HttpServletRequest request, int scope) {
|
448 |
0
| return generateEntryKey(key, request, scope, null, null);
|
449 |
| } |
450 |
| |
451 |
| |
452 |
| |
453 |
| |
454 |
| |
455 |
| |
456 |
| |
457 |
| |
458 |
| |
459 |
| |
460 |
| |
461 |
| |
462 |
| |
463 |
| |
464 |
| |
465 |
| |
466 |
| |
467 |
| |
468 |
| |
469 |
0
| public String generateEntryKey(String key, HttpServletRequest request, int scope, String language) {
|
470 |
0
| return generateEntryKey(key, request, scope, language, null);
|
471 |
| } |
472 |
| |
473 |
| |
474 |
| |
475 |
| |
476 |
| |
477 |
| |
478 |
| |
479 |
| |
480 |
| |
481 |
| |
482 |
| |
483 |
| |
484 |
| |
485 |
| |
486 |
| |
487 |
| |
488 |
| |
489 |
| |
490 |
| |
491 |
| |
492 |
0
| public String generateEntryKey(String key, HttpServletRequest request, int scope, String language, String suffix) {
|
493 |
| |
494 |
| |
495 |
| |
496 |
0
| StringBuffer cBuffer = new StringBuffer(AVERAGE_KEY_LENGTH);
|
497 |
| |
498 |
| |
499 |
0
| if (language != null) {
|
500 |
0
| cBuffer.append(FILE_SEPARATOR).append(language);
|
501 |
| } |
502 |
| |
503 |
| |
504 |
0
| if (useHostDomainInKey) {
|
505 |
0
| cBuffer.append(FILE_SEPARATOR).append(request.getServerName());
|
506 |
| } |
507 |
| |
508 |
0
| if (key != null) {
|
509 |
0
| cBuffer.append(FILE_SEPARATOR).append(key);
|
510 |
| } else { |
511 |
0
| String generatedKey = request.getRequestURI();
|
512 |
| |
513 |
0
| if (generatedKey.charAt(0) != FILE_SEPARATOR_CHAR) {
|
514 |
0
| cBuffer.append(FILE_SEPARATOR_CHAR);
|
515 |
| } |
516 |
| |
517 |
0
| cBuffer.append(generatedKey);
|
518 |
0
| cBuffer.append("_").append(request.getMethod()).append("_");
|
519 |
| |
520 |
0
| generatedKey = getSortedQueryString(request);
|
521 |
| |
522 |
0
| if (generatedKey != null) {
|
523 |
0
| try {
|
524 |
0
| java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
|
525 |
0
| byte[] b = digest.digest(generatedKey.getBytes());
|
526 |
0
| cBuffer.append("_");
|
527 |
| |
528 |
| |
529 |
0
| cBuffer.append(toBase64(b).replace('/', '_'));
|
530 |
| } catch (Exception e) { |
531 |
| |
532 |
| } |
533 |
| } |
534 |
| } |
535 |
| |
536 |
| |
537 |
0
| if ((suffix != null) && (suffix.length() > 0)) {
|
538 |
0
| cBuffer.append(suffix);
|
539 |
| } |
540 |
| |
541 |
0
| return cBuffer.toString();
|
542 |
| } |
543 |
| |
544 |
| |
545 |
| |
546 |
| |
547 |
| |
548 |
| |
549 |
| |
550 |
| |
551 |
| |
552 |
0
| protected String getSortedQueryString(HttpServletRequest request) {
|
553 |
0
| Map paramMap = request.getParameterMap();
|
554 |
| |
555 |
0
| if (paramMap.isEmpty()) {
|
556 |
0
| return null;
|
557 |
| } |
558 |
| |
559 |
0
| Set paramSet = new TreeMap(paramMap).entrySet();
|
560 |
| |
561 |
0
| StringBuffer buf = new StringBuffer();
|
562 |
| |
563 |
0
| boolean first = true;
|
564 |
| |
565 |
0
| for (Iterator it = paramSet.iterator(); it.hasNext();) {
|
566 |
0
| Map.Entry entry = (Map.Entry) it.next();
|
567 |
0
| String[] values = (String[]) entry.getValue();
|
568 |
| |
569 |
0
| for (int i = 0; i < values.length; i++) {
|
570 |
0
| String key = (String) entry.getKey();
|
571 |
| |
572 |
0
| if ((key.length() != 10) || !"jsessionid".equals(key)) {
|
573 |
0
| if (first) {
|
574 |
0
| first = false;
|
575 |
| } else { |
576 |
0
| buf.append('&');
|
577 |
| } |
578 |
| |
579 |
0
| buf.append(key).append('=').append(values[i]);
|
580 |
| } |
581 |
| } |
582 |
| } |
583 |
| |
584 |
| |
585 |
0
| if (buf.length() == 0) {
|
586 |
0
| return null;
|
587 |
| } else { |
588 |
0
| return buf.toString();
|
589 |
| } |
590 |
| } |
591 |
| |
592 |
| |
593 |
| |
594 |
| |
595 |
| |
596 |
| |
597 |
0
| public void logError(String message) {
|
598 |
0
| log.error("[oscache]: " + message);
|
599 |
| } |
600 |
| |
601 |
| |
602 |
| |
603 |
| |
604 |
| |
605 |
| |
606 |
| |
607 |
| |
608 |
| |
609 |
0
| public void putInCache(int scope, HttpServletRequest request, String key, Object content) {
|
610 |
0
| putInCache(scope, request, key, content, null);
|
611 |
| } |
612 |
| |
613 |
| |
614 |
| |
615 |
| |
616 |
| |
617 |
| |
618 |
| |
619 |
| |
620 |
| |
621 |
| |
622 |
0
| public void putInCache(int scope, HttpServletRequest request, String key, Object content, EntryRefreshPolicy policy) {
|
623 |
0
| Cache cache = getCache(request, scope);
|
624 |
0
| key = this.generateEntryKey(key, request, scope);
|
625 |
0
| cache.putInCache(key, content, policy);
|
626 |
| } |
627 |
| |
628 |
| |
629 |
| |
630 |
| |
631 |
| |
632 |
| |
633 |
| |
634 |
| |
635 |
| |
636 |
| |
637 |
0
| public void setCacheCapacity(int scope, HttpServletRequest request, int capacity) {
|
638 |
0
| setCacheCapacity(capacity);
|
639 |
0
| getCache(request, scope).setCapacity(capacity);
|
640 |
| } |
641 |
| |
642 |
| |
643 |
| |
644 |
| |
645 |
| |
646 |
| |
647 |
0
| public void removeScopeEventListener(ScopeEventListener listener) {
|
648 |
0
| listenerList.remove(ScopeEventListener.class, listener);
|
649 |
| } |
650 |
| |
651 |
| |
652 |
| |
653 |
| |
654 |
0
| protected void finalizeListeners(Cache cache) {
|
655 |
0
| super.finalizeListeners(cache);
|
656 |
| } |
657 |
| |
658 |
| |
659 |
| |
660 |
| |
661 |
0
| private static String toBase64(byte[] aValue) {
|
662 |
0
| int byte1;
|
663 |
0
| int byte2;
|
664 |
0
| int byte3;
|
665 |
0
| int iByteLen = aValue.length;
|
666 |
0
| StringBuffer tt = new StringBuffer();
|
667 |
| |
668 |
0
| for (int i = 0; i < iByteLen; i += 3) {
|
669 |
0
| boolean bByte2 = (i + 1) < iByteLen;
|
670 |
0
| boolean bByte3 = (i + 2) < iByteLen;
|
671 |
0
| byte1 = aValue[i] & 0xFF;
|
672 |
0
| byte2 = (bByte2) ? (aValue[i + 1] & 0xFF) : 0;
|
673 |
0
| byte3 = (bByte3) ? (aValue[i + 2] & 0xFF) : 0;
|
674 |
| |
675 |
0
| tt.append(m_strBase64Chars.charAt(byte1 / 4));
|
676 |
0
| tt.append(m_strBase64Chars.charAt((byte2 / 16) + ((byte1 & 0x3) * 16)));
|
677 |
0
| tt.append(((bByte2) ? m_strBase64Chars.charAt((byte3 / 64) + ((byte2 & 0xF) * 4)) : '='));
|
678 |
0
| tt.append(((bByte3) ? m_strBase64Chars.charAt(byte3 & 0x3F) : '='));
|
679 |
| } |
680 |
| |
681 |
0
| return tt.toString();
|
682 |
| } |
683 |
| |
684 |
| |
685 |
| |
686 |
| |
687 |
| |
688 |
| |
689 |
| |
690 |
| |
691 |
0
| private ServletCache createCache(int scope, String sessionId) {
|
692 |
0
| ServletCache newCache = new ServletCache(this, algorithmClass, cacheCapacity, scope);
|
693 |
| |
694 |
| |
695 |
| |
696 |
| |
697 |
| |
698 |
0
| config.set(HASH_KEY_SCOPE, "" + scope);
|
699 |
0
| config.set(HASH_KEY_SESSION_ID, sessionId);
|
700 |
| |
701 |
0
| newCache = (ServletCache) configureStandardListeners(newCache);
|
702 |
| |
703 |
0
| if (config.getProperty(CACHE_ENTRY_EVENT_LISTENERS_KEY) != null) {
|
704 |
| |
705 |
0
| CacheEventListener[] listeners = getCacheEventListeners();
|
706 |
| |
707 |
0
| for (int i = 0; i < listeners.length; i++) {
|
708 |
0
| if (listeners[i] instanceof ScopeEventListener) {
|
709 |
0
| newCache.addCacheEventListener(listeners[i], ScopeEventListener.class);
|
710 |
| } |
711 |
| } |
712 |
| } |
713 |
| |
714 |
0
| return newCache;
|
715 |
| } |
716 |
| |
717 |
| |
718 |
| |
719 |
| |
720 |
| |
721 |
| |
722 |
| |
723 |
| |
724 |
| |
725 |
0
| private void dispatchScopeEvent(ScopeEventType eventType, int scope, Date date, String origin) {
|
726 |
| |
727 |
0
| ScopeEvent event = new ScopeEvent(eventType, scope, date, origin);
|
728 |
| |
729 |
| |
730 |
0
| Object[] listeners = listenerList.getListenerList();
|
731 |
| |
732 |
| |
733 |
| |
734 |
0
| for (int i = listeners.length - 2; i >= 0; i -= 2) {
|
735 |
0
| if (listeners[i] == ScopeEventListener.class) {
|
736 |
0
| ((ScopeEventListener) listeners[i + 1]).scopeFlushed(event);
|
737 |
| } |
738 |
| } |
739 |
| } |
740 |
| |
741 |
| |
742 |
| |
743 |
| |
744 |
| |
745 |
0
| private void initHostDomainInKey() {
|
746 |
0
| String propStr = getProperty(CACHE_USE_HOST_DOMAIN_KEY);
|
747 |
| |
748 |
0
| useHostDomainInKey = "true".equalsIgnoreCase(propStr);
|
749 |
| } |
750 |
| } |