* 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;
* 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>
* 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) {
* 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.
* 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>
* <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. */