Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneIndex.java @ 756:9092e52f94eb
better synchronization for lucene restore
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Jul 2016 05:14:19 -0600 |
parents | 1a101ac9ea46 |
children |
comparison
equal
deleted
inserted
replaced
755:ff865e954934 | 756:9092e52f94eb |
---|---|
235 wrote(); | 235 wrote(); |
236 writeLock.unlock(); | 236 writeLock.unlock(); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 public void run_in_lock(LuanState luan,LuanFunction fn) throws IOException, LuanException { | |
241 if( writeLock.isHeldByCurrentThread() ) | |
242 throw new RuntimeException(); | |
243 writeLock.lock(); | |
244 try { | |
245 synchronized(this) { | |
246 fn.call(luan); | |
247 } | |
248 } finally { | |
249 wrote(); | |
250 writeLock.unlock(); | |
251 } | |
252 } | |
253 | |
240 | 254 |
241 private long id; | 255 private long id; |
242 private long idLim; | 256 private long idLim; |
243 private final int idBatch = 10; | 257 private final int idBatch = 10; |
244 | 258 |