mirror of https://github.com/apache/archiva.git
maven indexer cleanup only directory content so cleanup manually directory too
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1198370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0da6ef6d8c
commit
7738486c1a
|
@ -23,6 +23,7 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
|||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
|
||||
|
@ -130,6 +131,12 @@ public class DefaultIndexMerger
|
|||
{
|
||||
indexer.removeIndexingContext( indexingContext, true );
|
||||
}
|
||||
File directory = temporaryGroupIndex.getDirectory();
|
||||
if ( directory != null && directory.exists() )
|
||||
{
|
||||
FileUtils.deleteDirectory( directory );
|
||||
}
|
||||
temporaryGroupIndexes.remove( temporaryGroupIndex );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
|
|
@ -21,14 +21,12 @@ package org.apache.archiva.indexer.merger;
|
|||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
@ -61,24 +59,8 @@ public class TemporaryGroupIndexCleaner
|
|||
// cleanup files older than 60 minutes 3600000
|
||||
if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > 3600000 )
|
||||
{
|
||||
try
|
||||
{
|
||||
IndexingContext context = indexer.getIndexingContexts().get( temporaryGroupIndex.getIndexId() );
|
||||
if ( context != null )
|
||||
{
|
||||
indexer.removeIndexingContext( context, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
|
||||
}
|
||||
indexMerger.getTemporaryGroupIndexes().remove( temporaryGroupIndex );
|
||||
log.debug( "remove directory {}", temporaryGroupIndex.getDirectory() );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
log.warn( "failed to remove directory:" + temporaryGroupIndex.getDirectory(), e );
|
||||
}
|
||||
indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue