MCPcopy Create free account
hub / github.com/badvision/jace / run

Method run

src/main/java/jace/library/MediaCache.java:308–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

306 long timeCheck = 0;
307
308 @Override
309 public void run() {
310 while (true) {
311 try {
312 Thread.sleep(DELAY_BEFORE_PERSISTING_LIBRARY / 2);
313 // Wait half the delay before capturing the value
314 // this will help avoid unnecessary delays when the
315 // library is updated a bunch in a small interval of time
316 timeCheck = lastDirtyMarker;
317 Thread.sleep(DELAY_BEFORE_PERSISTING_LIBRARY / 2);
318 } catch (InterruptedException ex) {
319 Logger.getLogger(MediaCache.class.getName()).log(Level.SEVERE, null, ex);
320 continue;
321 }
322 // If the invalidation time stamp changed again wait longer
323 if (timeCheck != lastDirtyMarker) {
324 continue;
325 }
326 writeLibraryToDisk();
327 // If the invalidation stamp wasn't changed then the worker can exit
328 if (timeCheck == lastDirtyMarker) {
329 break;
330 }
331 }
332 }
333 });
334 writerWorker.start();
335 }

Callers 8

gripeMethod · 0.45
doTickMethod · 0.45
whileSuspendedMethod · 0.45
whilePausedMethod · 0.45
performSoundOperationMethod · 0.45
whileSuspendedMethod · 0.45
doTickMethod · 0.45
insertMediaMethod · 0.45

Calls 3

writeLibraryToDiskMethod · 0.95
getNameMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected