add closeQuietly method for repository session when only reading we can ignore this error.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1447103 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-17 23:51:08 +00:00
parent 633f2cbfa1
commit b9c19ce3c2
3 changed files with 21 additions and 1 deletions

View File

@ -703,7 +703,7 @@ public class DefaultBrowseService
{
if ( session != null )
{
session.close();
session.closeQuietly();
}
}

View File

@ -197,11 +197,18 @@ public interface MetadataRepository
throws MetadataRepositoryException;
/**
* <b>implementations can throw RuntimeException</b>
*/
void save();
void close()
throws MetadataRepositoryException;
/**
* <b>implementations can throw RuntimeException</b>
*/
void revert();
boolean canObtainAccess( Class<?> aClass );

View File

@ -82,6 +82,7 @@ public class RepositorySession
* If the session has been marked as dirty, it will be saved. This may save partial changes in the case of a typical
* <code>try { ... } finally { ... }</code> approach - if this is a problem, ensure you revert changes when an
* exception occurs.
* <b>can throw RuntimeException</b>
*/
public void close()
{
@ -105,6 +106,18 @@ public class RepositorySession
}
}
public void closeQuietly()
{
try
{
this.close();
}
catch ( RuntimeException e )
{
log.warn( "ignore Runtime exception while closing: {}", e.getMessage() );
}
}
public void markDirty()
{