01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.ocache.impl;
10:
11: import com.completex.objective.components.ocache.OdalKeyFactory;
12: import com.completex.objective.components.ocache.OdalKeyedCache;
13: import com.completex.objective.components.ocache.SafeWrapper;
14: import com.completex.objective.components.ocache.OdalCache;
15:
16: /**
17: * Thread safe OdalCache decorator for BasicCacheImpl
18: *
19: * @author Gennady Krizhevsky
20: */
21: public class SafeBasicCacheImpl implements OdalKeyedCache, SafeWrapper {
22: private final BasicCacheImpl delegate;
23:
24: public SafeBasicCacheImpl(BasicCacheImpl coreCache) {
25: delegate = coreCache;
26: }
27:
28: /**
29: * @see com.completex.objective.components.ocache.OdalKeyedCache#getKeyFactory()
30: */
31: public synchronized OdalKeyFactory getKeyFactory() {
32: return delegate.getKeyFactory();
33: }
34:
35: /**
36: * @see com.completex.objective.components.ocache.OdalKeyedCache#isMarkCacheCollectionElements()
37: */
38: public boolean isMarkCacheCollectionElements() {
39: return delegate.isMarkCacheCollectionElements();
40: }
41:
42: /**
43: * @see com.completex.objective.components.ocache.OdalCache#get(Object)
44: */
45: public synchronized Object get(Object key) {
46: return delegate.get(key);
47: }
48:
49: public void put(Object value) {
50: delegate.put(value);
51: }
52:
53: /**
54: * @see com.completex.objective.components.ocache.OdalCache#put(Object, Object)
55: */
56: public synchronized Object put(Object key, Object value) {
57: return delegate.put(key, value);
58: }
59:
60: /**
61: * @see com.completex.objective.components.ocache.OdalCache#remove(Object)
62: */
63: public synchronized Object remove(Object key) {
64: return delegate.remove(key);
65: }
66:
67: /**
68: * @see com.completex.objective.components.ocache.OdalCache#clear()
69: */
70: public synchronized void clear() {
71: delegate.clear();
72: }
73:
74: /**
75: * @see com.completex.objective.components.ocache.OdalCache#getName()
76: */
77: public String getName() {
78: return delegate.getName();
79: }
80:
81: /**
82: * @see com.completex.objective.components.ocache.SafeWrapper#getDelegate()
83: */
84: public OdalKeyedCache getDelegate() {
85: return delegate;
86: }
87:
88: public OdalCache getCoreCache() {
89: return delegate;
90: }
91: }
|