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:
parent
c26bc63ef1
commit
27ae8bc655
|
@ -82,7 +82,7 @@
|
||||||
* methods in this class may for example offer too much functionality or they
|
* methods in this class may for example offer too much functionality or they
|
||||||
* offer the functionality with the wrong arguments.
|
* offer the functionality with the wrong arguments.
|
||||||
*/
|
*/
|
||||||
public class Git {
|
public class Git implements AutoCloseable {
|
||||||
/** The git repository this class is interacting with */
|
/** The git repository this class is interacting with */
|
||||||
private final Repository repo;
|
private final Repository repo;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
* delta packed format yielding high compression of lots of object where some
|
* delta packed format yielding high compression of lots of object where some
|
||||||
* objects are similar.
|
* objects are similar.
|
||||||
*/
|
*/
|
||||||
public final class DfsPackFile {
|
public final class DfsPackFile implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
* File offset used to cache {@link #index} in {@link DfsBlockCache}.
|
* File offset used to cache {@link #index} in {@link DfsBlockCache}.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -89,7 +89,8 @@
|
||||||
* delta packed format yielding high compression of lots of object where some
|
* delta packed format yielding high compression of lots of object where some
|
||||||
* objects are similar.
|
* 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. */
|
/** Sorts PackFiles to be most recently created to least recently created. */
|
||||||
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
|
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
|
||||||
public int compare(final PackFile a, final PackFile b) {
|
public int compare(final PackFile a, final PackFile b) {
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
* An object database stores one or more Git objects, indexed by their unique
|
* An object database stores one or more Git objects, indexed by their unique
|
||||||
* {@link ObjectId}.
|
* {@link ObjectId}.
|
||||||
*/
|
*/
|
||||||
public abstract class ObjectDatabase {
|
public abstract class ObjectDatabase implements AutoCloseable {
|
||||||
/** Initialize a new database instance for access. */
|
/** Initialize a new database instance for access. */
|
||||||
protected ObjectDatabase() {
|
protected ObjectDatabase() {
|
||||||
// Protected to force extension.
|
// Protected to force extension.
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
* Every {@link Repository} has a single reference database, mapping names to
|
* Every {@link Repository} has a single reference database, mapping names to
|
||||||
* the tips of the object graph contained by the {@link ObjectDatabase}.
|
* 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.
|
* Order of prefixes to search when using non-absolute references.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
* <p>
|
* <p>
|
||||||
* This class is thread-safe.
|
* This class is thread-safe.
|
||||||
*/
|
*/
|
||||||
public abstract class Repository {
|
public abstract class Repository implements AutoCloseable {
|
||||||
private static final ListenerList globalListeners = new ListenerList();
|
private static final ListenerList globalListeners = new ListenerList();
|
||||||
|
|
||||||
/** @return the global listener list observing all events in this JVM. */
|
/** @return the global listener list observing all events in this JVM. */
|
||||||
|
|
Loading…
Reference in New Issue