/** * @param clsr Continuous query closure. * @param sync Synchronous continuous query flag. */ public final void addContinuousQueryClosure(CI1<Boolean> clsr, boolean sync) { assert !isDone() : this; if (sync) clsr.apply(true); else { if (cntQryClsrs == null) cntQryClsrs = new ArrayList<>(10); cntQryClsrs.add(clsr); } }
/** * Unregisters from all the partitions and unpublishes this reservation. */ private void unregister() { GridDhtLocalPartition[] arr = parts.get(); // Unregister from partitions. if (!F.isEmpty(arr) && parts.compareAndSet(arr, EMPTY)) { // Reverse order makes sure that addReservation on the same topVer // reservation will fail on the first partition. for (int i = arr.length - 1; i >= 0; i--) { GridDhtLocalPartition part = arr[i]; part.removeReservation(this); } } // Unpublish. CI1<GridDhtPartitionsReservation> u = unpublish.get(); if (u != null && u != NO_OP && unpublish.compareAndSet(u, NO_OP)) u.apply(this); }
/** {@inheritDoc} */ @Override public final boolean onDone(@Nullable Void res, @Nullable Throwable err) { if (super.onDone(res, err)) { cctx.mvcc().removeAtomicFuture(futId); boolean suc = err == null; if (cntQryClsrs != null) { for (CI1<Boolean> clsr : cntQryClsrs) clsr.apply(suc); } return true; } return false; }
/** * @param clsr Continuous query closure. * @param sync Synchronous continuous query flag. */ public final void addContinuousQueryClosure(CI1<Boolean> clsr, boolean sync) { assert !isDone() : this; if (sync) clsr.apply(true); else { if (cntQryClsrs == null) cntQryClsrs = new ArrayList<>(10); cntQryClsrs.add(clsr); } }
/** * Unregisters from all the partitions and unpublishes this reservation. */ private void unregister() { GridDhtLocalPartition[] arr = parts.get(); // Unregister from partitions. if (!F.isEmpty(arr) && parts.compareAndSet(arr, EMPTY)) { // Reverse order makes sure that addReservation on the same topVer // reservation will fail on the first partition. for (int i = arr.length - 1; i >= 0; i--) { GridDhtLocalPartition part = arr[i]; part.removeReservation(this); } } // Unpublish. CI1<GridDhtPartitionsReservation> u = unpublish.get(); if (u != null && u != NO_OP && unpublish.compareAndSet(u, NO_OP)) u.apply(this); }
/** {@inheritDoc} */ @Override public final boolean onDone(@Nullable Void res, @Nullable Throwable err) { if (super.onDone(res, err)) { cctx.mvcc().removeAtomicFuture(futId); boolean suc = err == null; if (cntQryClsrs != null) { for (CI1<Boolean> clsr : cntQryClsrs) clsr.apply(suc); } return true; } return false; }