Set<ObjectId> remoteObjects = new HashSet<ObjectId>();
Set<ObjectId> newObjects = new HashSet<ObjectId>();
- final PackWriter writer = new PackWriter(transport.getPackConfig(),
- local.newObjectReader());
- try {
+ try (final PackWriter writer = new PackWriter(transport.getPackConfig(),
+ local.newObjectReader())) {
for (final Ref r : getRefs()) {
// only add objects that we actually have
writer.setDeltaBaseAsOffset(capableOfsDelta);
writer.preparePack(monitor, newObjects, remoteObjects);
writer.writePack(monitor, monitor, out);
- } finally {
- writer.release();
+
+ packTransferTime = writer.getStatistics().getTimeWriting();
}
- packTransferTime = writer.getStatistics().getTimeWriting();
}
private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates)