repository client should be closeable

This commit is contained in:
Sebastian Sdorra
2012-07-15 15:57:33 +02:00
parent de01c03642
commit 2f464b57d9
2 changed files with 42 additions and 2 deletions

View File

@@ -33,17 +33,24 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.io.Closeables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.client.spi.RepositoryClientProvider;
//~--- JDK imports ------------------------------------------------------------
import java.io.Closeable;
import java.io.IOException;
/**
*
* @author Sebastian Sdorra
* @since 1.18
*/
public final class RepositoryClient
public final class RepositoryClient implements Closeable
{
/**
@@ -66,6 +73,23 @@ public final class RepositoryClient
this.clientProvider = clientProvider;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*/
@Override
public void close()
{
if (logger.isTraceEnabled())
{
logger.trace("close client provider");
}
Closeables.closeQuietly(clientProvider);
}
//~--- get methods ----------------------------------------------------------
/**

View File

@@ -38,6 +38,9 @@ import sonia.scm.repository.client.api.ClientCommandNotSupportedException;
//~--- JDK imports ------------------------------------------------------------
import java.io.Closeable;
import java.io.IOException;
import java.util.Set;
/**
@@ -45,7 +48,7 @@ import java.util.Set;
* @author Sebastian Sdorra
* @since 1.18
*/
public abstract class RepositoryClientProvider
public abstract class RepositoryClientProvider implements Closeable
{
/**
@@ -56,6 +59,19 @@ public abstract class RepositoryClientProvider
*/
public abstract Set<ClientCommand> getSupportedClientCommands();
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @throws IOException
*/
@Override
public void close() throws IOException {}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*