@@ -44,7 +44,7 @@ public final class GetSnapshotInfoContext implements ActionListener<SnapshotInfo
4444
4545 /**
4646 * Listener resolved when fetching {@link SnapshotInfo} has completed. If resolved successfully, no more calls to
47- * {@link #onSnapshotInfo } will be made. Only resolves exceptionally if {@link #abortOnFailure} is true in case one or more
47+ * {@link #consumer } will be made. Only resolves exceptionally if {@link #abortOnFailure} is true in case one or more
4848 * {@link SnapshotInfo} failed to be fetched.
4949 */
5050 private final ActionListener <Void > doneListener ;
@@ -53,23 +53,25 @@ public final class GetSnapshotInfoContext implements ActionListener<SnapshotInfo
5353 * {@link BiConsumer} invoked for each {@link SnapshotInfo} that is fetched with this instance and the {@code SnapshotInfo} as
5454 * arguments.
5555 */
56- private final BiConsumer <GetSnapshotInfoContext , SnapshotInfo > onSnapshotInfo ;
56+ private final BiConsumer <GetSnapshotInfoContext , SnapshotInfo > consumer ;
5757
5858 private final CountDown counter ;
5959
6060 public GetSnapshotInfoContext (
6161 Collection <SnapshotId > snapshotIds ,
6262 boolean abortOnFailure ,
6363 BooleanSupplier isCancelled ,
64- BiConsumer <GetSnapshotInfoContext , SnapshotInfo > onSnapshotInfo ,
64+ BiConsumer <GetSnapshotInfoContext , SnapshotInfo > consumer ,
6565 ActionListener <Void > listener
6666 ) {
67- assert snapshotIds .isEmpty () == false : "no snapshot ids to fetch given" ;
67+ if (snapshotIds .isEmpty ()) {
68+ throw new IllegalArgumentException ("no snapshot ids to fetch given" );
69+ }
6870 this .snapshotIds = List .copyOf (snapshotIds );
6971 this .counter = new CountDown (snapshotIds .size ());
7072 this .abortOnFailure = abortOnFailure ;
7173 this .isCancelled = isCancelled ;
72- this .onSnapshotInfo = onSnapshotInfo ;
74+ this .consumer = consumer ;
7375 this .doneListener = listener ;
7476 }
7577
@@ -101,7 +103,7 @@ public boolean done() {
101103 @ Override
102104 public void onResponse (SnapshotInfo snapshotInfo ) {
103105 try {
104- onSnapshotInfo .accept (this , snapshotInfo );
106+ consumer .accept (this , snapshotInfo );
105107 } catch (Exception e ) {
106108 assert false : e ;
107109 onFailure (e );
0 commit comments