Java Code Examples for org.openide.util.Mutex#writeAccess()
The following examples show how to use
org.openide.util.Mutex#writeAccess() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenProjectCache.java From netbeans with Apache License 2.0 | 5 votes |
public static void clearMavenProject(final File pomFile) { Mutex mutex = getMutex(pomFile); mutex.writeAccess(new Action<MavenProject>() { @Override public MavenProject run() { file2Project.remove(pomFile); return null; } }); }
Example 2
Source File: NexusRepositoryIndexerImpl.java From netbeans with Apache License 2.0 | 4 votes |
private void iterate(List<RepositoryInfo> repos, final RepoAction action, final RepoAction actionSkip, final boolean skipUnIndexed) { if (repos == null) { repos = RepositoryPreferences.getInstance().getRepositoryInfos(); } for (final RepositoryInfo repo : repos) { Mutex mutex = getRepoMutex(repo); if (skipUnIndexed && isIndexing(mutex)) { try { actionSkip.run(repo, null); } catch (IOException ex) { LOGGER.log(Level.FINER, "could not skip " + repo.getId(), ex); } } else { mutex.writeAccess(new Mutex.Action<Void>() { public @Override Void run() { try { boolean index = loadIndexingContext2(repo); if (skipUnIndexed && index) { if (!RepositoryPreferences.isIndexRepositories()) { return null; } actionSkip.run(repo, null); spawnIndexLoadedRepo(repo); return null; } IndexingContext context = getIndexingContexts().get(repo.getId()); if (context == null) { if (skipUnIndexed) { actionSkip.run(repo, null); } return null; } action.run(repo, context); } catch (IOException x) { LOGGER.log(Level.INFO, "could not process " + repo.getId(), x); } return null; } }); } } }