Skip to content

Commit

Permalink
Close snapshots from BarrageTableResolver (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
devinrsmith authored May 24, 2022
1 parent 80e3567 commit a91d482
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ BarrageSnapshot snapshot(TableSpec tableSpec, BarrageSnapshotOptions options)
* @return the {@code BarrageTable}
*/
BarrageTable partialTable(RowSet viewport, BitSet columns, boolean reverseViewport) throws InterruptedException;

@Override
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ public Table snapshot(String targetUri, TableSpec table) throws TableHandleExcep
public Table snapshot(DeephavenTarget target, TableSpec table, BarrageSnapshotOptions options)
throws TableHandleException, InterruptedException {
final BarrageSession session = session(target);
final BarrageSnapshot snap = session.snapshot(table, options);
return snap.entireTable();
try (final BarrageSnapshot snap = session.snapshot(table, options)) {
return snap.entireTable();
}
}

/**
Expand Down Expand Up @@ -270,8 +271,9 @@ public Table snapshot(DeephavenTarget target, TableSpec table, BarrageSnapshotOp
BitSet columns, boolean reverseViewport)
throws TableHandleException, InterruptedException {
final BarrageSession session = session(target);
final BarrageSnapshot snap = session.snapshot(table, options);
return snap.partialTable(viewport, columns, reverseViewport);
try (final BarrageSnapshot snap = session.snapshot(table, options)) {
return snap.partialTable(viewport, columns, reverseViewport);
}
}


Expand Down

0 comments on commit a91d482

Please sign in to comment.