1 2 12 package com.versant.core.jdo; 13 14 import java.util.Iterator ; 15 import java.util.Collection ; 16 import java.util.List ; 17 import java.util.ListIterator ; 18 19 24 public final class SynchronizedQueryResult implements QueryResult { 25 26 private final Object lock; 27 private final QueryResult q; 28 29 public SynchronizedQueryResult(Object lock, QueryResult q) { 30 this.lock = lock; 31 this.q = q; 32 } 33 34 public QueryResult getNext() { 35 return q.getNext(); 36 } 37 38 public void setNext(QueryResult next) { 39 q.setNext(next); 40 } 41 42 public QueryResult getPrev() { 43 return q.getPrev(); 44 } 45 46 public void setPrev(QueryResult prev) { 47 q.setPrev(prev); 48 } 49 50 public void close() { 51 synchronized (lock) { 52 q.close(); 53 } 54 } 55 56 public void setParams(Object [] params) { 57 synchronized (lock) { 58 q.setParams(params); 59 } 60 } 61 62 public Iterator createInternalIterNoFlush() { 63 synchronized (lock) { 64 return q.createInternalIterNoFlush(); 65 } 66 } 67 68 public int size() { 69 synchronized (lock) { 70 return q.size(); 71 } 72 } 73 74 public void clear() { 75 synchronized (lock) { 76 q.clear(); 77 } 78 } 79 80 public boolean isEmpty() { 81 synchronized (lock) { 82 return q.isEmpty(); 83 } 84 } 85 86 public Object [] toArray() { 87 synchronized (lock) { 88 return q.toArray(); 89 } 90 } 91 92 public Object get(int index) { 93 synchronized (lock) { 94 return q.get(index); 95 } 96 } 97 98 public Object remove(int index) { 99 synchronized (lock) { 100 return q.remove(index); 101 } 102 } 103 104 public void add(int index, Object element) { 105 synchronized (lock) { 106 q.add(index, element); 107 } 108 } 109 110 public int indexOf(Object o) { 111 synchronized (lock) { 112 return q.indexOf(o); 113 } 114 } 115 116 public int lastIndexOf(Object o) { 117 synchronized (lock) { 118 return q.lastIndexOf(o); 119 } 120 } 121 122 public boolean add(Object o) { 123 synchronized (lock) { 124 return q.add(o); 125 } 126 } 127 128 public boolean contains(Object o) { 129 synchronized (lock) { 130 return q.contains(o); 131 } 132 } 133 134 public boolean remove(Object o) { 135 synchronized (lock) { 136 return q.remove(o); 137 } 138 } 139 140 public boolean addAll(int index, Collection c) { 141 synchronized (lock) { 142 return q.addAll(index, c); 143 } 144 } 145 146 public boolean addAll(Collection c) { 147 synchronized (lock) { 148 return q.addAll(c); 149 } 150 } 151 152 public boolean containsAll(Collection c) { 153 synchronized (lock) { 154 return q.containsAll(c); 155 } 156 } 157 158 public boolean removeAll(Collection c) { 159 synchronized (lock) { 160 return q.removeAll(c); 161 } 162 } 163 164 public boolean retainAll(Collection c) { 165 synchronized (lock) { 166 return q.retainAll(c); 167 } 168 } 169 170 public Iterator iterator() { 171 synchronized (lock) { 172 return q.iterator(); 173 } 174 } 175 176 public List subList(int fromIndex, int toIndex) { 177 synchronized (lock) { 178 return q.subList(fromIndex, toIndex); 179 } 180 } 181 182 public ListIterator listIterator() { 183 synchronized (lock) { 184 return q.listIterator(); 185 } 186 } 187 188 public ListIterator listIterator(int index) { 189 synchronized (lock) { 190 return q.listIterator(index); 191 } 192 } 193 194 public Object set(int index, Object element) { 195 synchronized (lock) { 196 return q.set(index, element); 197 } 198 } 199 200 public Object [] toArray(Object a[]) { 201 synchronized (lock) { 202 return q.toArray(a); 203 } 204 } 205 206 } 207 208 | Popular Tags |