/**
   * Constructor.
   *
   * @param name Latch name.
   * @param cnt Current count.
   * @param initCnt Initial count.
   * @param autoDel Auto delete flag.
   * @param key Latch key.
   * @param latchView Latch projection.
   * @param ctx Cache context.
   */
  public GridCacheCountDownLatchImpl(
      String name,
      int cnt,
      int initCnt,
      boolean autoDel,
      GridCacheInternalKey key,
      GridCacheProjection<GridCacheInternalKey, GridCacheCountDownLatchValue> latchView,
      GridCacheContext ctx) {
    assert name != null;
    assert cnt >= 0;
    assert initCnt >= 0;
    assert key != null;
    assert latchView != null;
    assert ctx != null;

    this.name = name;
    this.cnt = cnt;
    this.initCnt = initCnt;
    this.autoDel = autoDel;
    this.key = key;
    this.latchView = latchView;
    this.ctx = ctx;

    log = ctx.gridConfig().getGridLogger().getLogger(getClass());
  }
 /** {@inheritDoc} */
 @Override
 public GridFuture<Boolean> awaitAsync(final long timeout, final TimeUnit unit) {
   return ctx.closures()
       .callLocalSafe(
           new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
               return await(timeout, unit);
             }
           },
           true);
 }
  /** {@inheritDoc} */
  @Override
  public GridFuture<?> awaitAsync() {
    return ctx.closures()
        .callLocalSafe(
            new Callable<Object>() {
              @Nullable
              @Override
              public Object call() throws Exception {
                await();

                return null;
              }
            },
            true);
  }
 /** {@inheritDoc} */
 @Override
 public GridFuture<?> countDownAllAsync() {
   return ctx.closures().callLocalSafe(new CountDownCallable(0), true);
 }
 /** {@inheritDoc} */
 @Override
 public GridFuture<Integer> countDownAsync(int val) {
   return ctx.closures().callLocalSafe(new CountDownCallable(val), true);
 }