Implement AutoClosable interface to support try-with-resources block

Bug: 428039
Change-Id: I41880862db5303b5bea4b2184ba7844d69c997b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2015-01-27 11:14:22 +01:00 committed by Christian Halstrick
parent c26bc63ef1
commit 27ae8bc655
6 changed files with 7 additions and 6 deletions

View File

@ -82,7 +82,7 @@
* methods in this class may for example offer too much functionality or they
* offer the functionality with the wrong arguments.
*/
public class Git {
public class Git implements AutoCloseable {
/** The git repository this class is interacting with */
private final Repository repo;

View File

@ -88,7 +88,7 @@
* delta packed format yielding high compression of lots of object where some
* objects are similar.
*/
public final class DfsPackFile {
public final class DfsPackFile implements AutoCloseable {
/**
* File offset used to cache {@link #index} in {@link DfsBlockCache}.
* <p>

View File

@ -89,7 +89,8 @@
* delta packed format yielding high compression of lots of object where some
* objects are similar.
*/
public class PackFile implements Iterable<PackIndex.MutableEntry> {
public class PackFile implements Iterable<PackIndex.MutableEntry>,
AutoCloseable {
/** Sorts PackFiles to be most recently created to least recently created. */
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
public int compare(final PackFile a, final PackFile b) {

View File

@ -54,7 +54,7 @@
* An object database stores one or more Git objects, indexed by their unique
* {@link ObjectId}.
*/
public abstract class ObjectDatabase {
public abstract class ObjectDatabase implements AutoCloseable {
/** Initialize a new database instance for access. */
protected ObjectDatabase() {
// Protected to force extension.

View File

@ -57,7 +57,7 @@
* Every {@link Repository} has a single reference database, mapping names to
* the tips of the object graph contained by the {@link ObjectDatabase}.
*/
public abstract class RefDatabase {
public abstract class RefDatabase implements AutoCloseable {
/**
* Order of prefixes to search when using non-absolute references.
* <p>

View File

@ -99,7 +99,7 @@
* <p>
* This class is thread-safe.
*/
public abstract class Repository {
public abstract class Repository implements AutoCloseable {
private static final ListenerList globalListeners = new ListenerList();
/** @return the global listener list observing all events in this JVM. */