/** Must be called from synchronized block*/ private JarFile reOpenJarFile() throws IOException { synchronized (closeSync) { if (closeTask != null) { closeTask.cancel(); } // #167527 - calculate adaptive delay before closing jar long now = System.currentTimeMillis(); long requestPeriod = now - openRequestTime; openRequestTime = now; // 150% of time from last open request, but between CLOSE_DELAY_MIN and CLOSE_DELAY_MAX closeDelay = (int) Math.min(CLOSE_DELAY_MAX, Math.max(CLOSE_DELAY_MIN, (1.5 * requestPeriod))); return getJar(true); } }
/** Performs a clean-up * After close of JarFile must be always reference to JarFile set to null */ private void closeCurrentRoot(boolean isRealClose) { synchronized (closeSync) { if (closeTask != null) { closeTask.cancel(); } if (isRealClose) { realClose().run(); } else { closeTask = req.post(realClose(), closeDelay); } } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { boolean result = cancellable == null ? true : cancellable.cancel(); if (result) { boolean taskCancelled = task.cancel(); boolean superCancel = super.cancel(mayInterruptIfRunning); //must call both! result = taskCancelled && superCancel; } return result; }
private void validate () { validateTask.cancel(); dd.setValid(false); validateTask.schedule(300); } });
@Override public boolean cancel() { if(prepareTask != null) { prepareTask.cancel(); } return true; } };
private void cancelTask() { if(evalTask != null) { evalTask.removeTaskListener(this); evalTask.cancel(); updateTimer.stop(); } }
@Override public boolean cancel() { if(prepareTask != null) { prepareTask.cancel(); } return true; } };
void cancelParsingTask() { if(parsingTask != null) { //there is schedulled or running parsing task -> cancel it! boolean removed = parsingTask.cancel(); parsingTask = null; jspColoringDataRef = null; } parsingTaskCancelled = true; }
public void reset() { displayer.setIcon(null); displayer.setText(Bundle.ImagePreviewPanel_NoImageMsg()); if (currentTask != null) { currentTask.cancel(); } }
public void clearImage() { displayer.setIcon(null); displayer.setText(Bundle.ImagePreviewPanel_GeneratingPreviewMsg()); if (currentTask != null) { currentTask.cancel(); } }
private void freeReference() { aliveCount--; // Nobody uses this JarFileSystem => stop watcher, close JarFile and throw away cache. if (aliveCount == 0) { if (watcherTask != null) { watcherTask.cancel(); watcherTask = null; } strongCache = null; // no more active FO, keep only soft ref closeCurrentRoot(false); } }
@Override public void close() throws IOException { task.cancel(); if (IONotifier.isSupported(io)) { IONotifier.removePropertyChangeListener(io, this); } }
private void cancelDetection() { if (detectTask != null) { detectTask.cancel(); } } private void updateSelectAllNonButtons() {
backgroundValidationTask.cancel();
protected @Override void removeNotify() { logger.log (Level.FINER, "removeNotify on {0}", new Object[] { this }); try { cancelled = true; task.cancel(); initialized = false; setKeys (Collections.<Object>emptyList()); } finally { synchronized (notifyLock) { //#170794 ensure setting of flag and call to add/removeNotify() are atomic if (notified) { factory.removeNotify(); } } } }
synchronized (REFRESH_RP) { if (refreshTask != null) { refreshTask.cancel(); } else { refreshTask = REFRESH_RP.create(new Runnable() {
private void freeReference() { aliveCount--; // Nobody uses this JarFileSystem => stop watcher, close JarFile and throw away cache. if (aliveCount == 0) { Task w = watcherTask; if (w != null) { w.cancel(); watcherTask = null; } strongCache = null; // no more active FO, keep only soft ref closeCurrentRoot(false); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { boolean result = true; if (toRun instanceof Cancellable) { result = ((Cancellable) toRun).cancel(); } if (result) { //will invoke cancelled.set(true) result = t.cancel(mayInterruptIfRunning); } return result; }