mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 19:45:51 +01:00
close subversion context, if the service provider is closed
This commit is contained in:
@@ -30,18 +30,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.repository.spi;
|
package sonia.scm.repository.spi;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.io.Closeables;
|
||||||
|
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.SvnRepositoryHandler;
|
import sonia.scm.repository.SvnRepositoryHandler;
|
||||||
|
import sonia.scm.repository.SvnUtil;
|
||||||
import sonia.scm.repository.api.Command;
|
import sonia.scm.repository.api.Command;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,8 +58,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final Set<Command> COMMANDS = ImmutableSet.of(Command.BLAME,
|
public static final Set<Command> COMMANDS = ImmutableSet.of(Command.BLAME,
|
||||||
Command.BROWSE, Command.CAT,
|
Command.BROWSE, Command.CAT,
|
||||||
Command.DIFF, Command.LOG);
|
Command.DIFF, Command.LOG);
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -66,12 +71,26 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
* @param repository
|
* @param repository
|
||||||
*/
|
*/
|
||||||
SvnRepositoryServiceProvider(SvnRepositoryHandler handler,
|
SvnRepositoryServiceProvider(SvnRepositoryHandler handler,
|
||||||
Repository repository)
|
Repository repository)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.context = new SvnContext(handler.getDirectory(repository));
|
this.context = new SvnContext(handler.getDirectory(repository));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException
|
||||||
|
{
|
||||||
|
Closeables.close(context, true);
|
||||||
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,8 +168,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private SvnContext context;
|
private final SvnContext context;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Repository repository;
|
private final Repository repository;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user