mirror of https://github.com/apache/archiva.git
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:
parent
633f2cbfa1
commit
b9c19ce3c2
|
@ -703,7 +703,7 @@ public class DefaultBrowseService
|
|||
{
|
||||
if ( session != null )
|
||||
{
|
||||
session.close();
|
||||
session.closeQuietly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue