/** * Used to close all indexing context explicitly. */ public void shutdown( boolean deleteFiles ) throws IOException { getLogger().info( "Shutting down Nexus IndexerManager" ); for ( IndexingContext ctx : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( ctx, false ); } locks.clear(); }
private void unloadIndexingContext(final RepositoryInfo... repos) throws IOException { assert MUTEX.isWriteAccess(); for (RepositoryInfo repo : repos) { LOGGER.finer("Unloading Context :" + repo.getId());//NOI18N IndexingContext ic = indexer.getIndexingContexts().get(repo.getId()); if (ic != null) { indexer.removeIndexingContext(ic, false); } } }
public Object run() throws Exception { IndexingContext indexingContext = indexer.addIndexingContext( // repoId, // context id repoId, // repository id repoDir, // repository folder new File(indexDir, repoId), // index folder null, // repositoryUrl null, // index update url NB_INDEX); if (indexingContext == null) { LOGGER.warning("Indexing context chould not be created :"+repoId);//NOI18N return null; } indexer.scan(indexingContext, new RepositoryIndexerListener(indexer, indexingContext, true), true); indexer.removeIndexingContext(indexingContext, false); return null; } });
public void removeRepositoryIndexContext( String repositoryId, boolean deleteFiles ) throws IOException, NoSuchRepositoryException { Repository repository = repositoryRegistry.getRepository( repositoryId ); Lock lock = getLock( repository ).writeLock(); lock.lock(); try { if ( !isIndexingSupported( repository ) ) { logSkippingRepositoryMessage( repository ); return; } IndexingContext localCtx = getRepositoryLocalIndexContext( repository ); IndexingContext remoteCtx = getRepositoryRemoteIndexContext( repository ); if ( localCtx != null ) { nexusIndexer.removeIndexingContext( localCtx, deleteFiles ); } if ( remoteCtx != null ) { nexusIndexer.removeIndexingContext( remoteCtx, deleteFiles ); } } finally { lock.unlock(); } }
indexer.removeIndexingContext( context, false );