Changeset 30532 in osm for applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java
- Timestamp:
- 2014-07-14T04:18:06+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java
r29484 r30532 49 49 protected Throwable writerFailedException = null; 50 50 51 52 protected final LongConcurrentHashMap<Fun.Tuple2<Object,Serializer>> items = new LongConcurrentHashMap<Fun.Tuple2<Object, Serializer>>(); 51 protected final LongConcurrentHashMap<Fun.Tuple2<Object,Serializer<Object>>> items = new LongConcurrentHashMap<>(); 53 52 54 53 protected final Thread newRecidsThread = new Thread("MapDB prealloc #"+threadNum){ … … 73 72 74 73 for(;;){ 75 LongMap.LongMapIterator<Fun.Tuple2<Object,Serializer >> iter = items.longMapIterator();74 LongMap.LongMapIterator<Fun.Tuple2<Object,Serializer<Object>>> iter = items.longMapIterator(); 76 75 77 76 if(!iter.moveToNext()){ … … 87 86 while(iter.moveToNext()){ 88 87 long recid = iter.key(); 89 Fun.Tuple2<Object,Serializer > value = iter.value();88 Fun.Tuple2<Object,Serializer<Object>> value = iter.value(); 90 89 if(value.a==DELETED){ 91 90 AsyncWriteEngine.super.delete(recid, value.b); … … 107 106 Utils.lock(writeLocks,recid); 108 107 try{ 109 Fun.Tuple2<Object,Serializer > value = iter.value();108 Fun.Tuple2<Object,Serializer<Object>> value = iter.value(); 110 109 if(value.a==DELETED){ 111 110 AsyncWriteEngine.super.delete(recid, value.b); … … 165 164 } 166 165 166 @SuppressWarnings("unchecked") 167 167 @Override 168 168 public <A> A get(long recid, Serializer<A> serializer) { … … 172 172 try{ 173 173 checkState(); 174 Fun.Tuple2<Object,Serializer > item = items.get(recid);174 Fun.Tuple2<Object,Serializer<Object>> item = items.get(recid); 175 175 if(item!=null){ 176 176 if(item.a == DELETED) return null; … … 187 187 } 188 188 189 @SuppressWarnings({ "rawtypes", "unchecked" }) 189 190 @Override 190 191 public <A> void update(long recid, A value, Serializer<A> serializer) { … … 206 207 } 207 208 209 @SuppressWarnings({ "unchecked", "rawtypes" }) 208 210 @Override 209 211 public <A> boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer) { … … 212 214 try{ 213 215 checkState(); 214 Fun.Tuple2<Object, Serializer > existing = items.get(recid);216 Fun.Tuple2<Object, Serializer<Object>> existing = items.get(recid); 215 217 A oldValue = existing!=null? (A) existing.a : super.get(recid, serializer); 216 218 if(oldValue == expectedOldValue || (oldValue!=null && oldValue.equals(expectedOldValue))){ … … 226 228 } 227 229 230 @SuppressWarnings("unchecked") 228 231 @Override 229 232 public <A> void delete(long recid, Serializer<A> serializer) { … … 245 248 shutdownCondition.await(); 246 249 247 248 250 super.close(); 249 251 } catch (InterruptedException e) { … … 251 253 } 252 254 } 253 254 255 255 256 256 protected WeakReference<Engine> parentEngineWeakRef = null; … … 302 302 } 303 303 } 304 305 304 }
Note:
See TracChangeset
for help on using the changeset viewer.