/** {@inheritDoc} */
  @Override
  public GridCacheQuery<T> timeout(long timeout) {
    A.ensure(timeout >= 0, "timeout >= 0");

    this.timeout = timeout;

    return this;
  }
  /** {@inheritDoc} */
  @Override
  public GridCacheQuery<T> pageSize(int pageSize) {
    A.ensure(pageSize > 0, "pageSize > 0");

    this.pageSize = pageSize;

    return this;
  }
  /** {@inheritDoc} */
  @Override
  public <T extends GridEvent> Collection<T> localEvents(GridPredicate<T> p) {
    A.notNull(p, "p");

    cleanupQueue();

    return F.retain((Collection<T>) evts, true, p);
  }
  /** {@inheritDoc} */
  @Override
  public void timeInterval(long timeInterval) {
    A.ensure(timeInterval >= 0, "timeInterval >= 0");

    if (!guard.enterBusy())
      throw new IllegalStateException("Continuous query can't be changed after it was executed.");

    try {
      this.timeInterval = timeInterval;
    } finally {
      guard.leaveBusy();
    }
  }
  /** {@inheritDoc} */
  @Override
  public void bufferSize(int bufSize) {
    A.ensure(bufSize > 0, "bufSize > 0");

    if (!guard.enterBusy())
      throw new IllegalStateException("Continuous query can't be changed after it was executed.");

    try {
      this.bufSize = bufSize;
    } finally {
      guard.leaveBusy();
    }
  }
  /** {@inheritDoc} */
  @Override
  public void callback(GridBiPredicate<UUID, Collection<Map.Entry<K, V>>> cb) {
    A.notNull(cb, "cb");

    if (!guard.enterBusy())
      throw new IllegalStateException("Continuous query can't be changed after it was executed.");

    try {
      this.cb = cb;
    } finally {
      guard.leaveBusy();
    }
  }
예제 #7
0
  /** {@inheritDoc} */
  @Override
  public void autoFlushFrequency(long autoFlushFreq) {
    A.ensure(autoFlushFreq >= 0, "autoFlushFreq >= 0");

    long old = this.autoFlushFreq;

    if (autoFlushFreq != old) {
      this.autoFlushFreq = autoFlushFreq;

      if (autoFlushFreq != 0 && old == 0) flushQ.add(this);
      else if (autoFlushFreq == 0) flushQ.remove(this);
    }
  }
예제 #8
0
  /** {@inheritDoc} */
  @Override
  public GridFuture<?> addData(Collection<? extends Map.Entry<K, V>> entries) {
    A.notEmpty(entries, "entries");

    enterBusy();

    try {
      GridFutureAdapter<Object> resFut = new GridFutureAdapter<>(ctx);

      activeFuts.add(resFut);

      resFut.listenAsync(rmvActiveFut);

      Collection<K> keys = new GridConcurrentHashSet<>(entries.size(), 1.0f, 16);

      for (Map.Entry<K, V> entry : entries) keys.add(entry.getKey());

      load0(entries, resFut, keys, 0);

      return resFut;
    } finally {
      leaveBusy();
    }
  }
  /**
   * Sets maximum allowed size of cache before entry will start getting evicted.
   *
   * @param max Maximum allowed size of cache before entry will start getting evicted.
   */
  @Override
  public void setMaxSize(int max) {
    A.ensure(max > 0, "max > 0");

    this.max = max;
  }
  /**
   * Constructs FIFO eviction policy with maximum size. Empty entries are allowed.
   *
   * @param max Maximum allowed size of cache before entry will start getting evicted.
   */
  public GridCacheFifoEvictionPolicy(int max) {
    A.ensure(max > 0, "max > 0");

    this.max = max;
  }
예제 #11
0
  /** {@inheritDoc} */
  @Override
  public GridFuture<?> addData(K key, V val) throws GridException, IllegalStateException {
    A.notNull(key, "key");

    return addData(new Entry0<>(key, val));
  }
예제 #12
0
  /** {@inheritDoc} */
  @Override
  public GridFuture<?> addData(Map.Entry<K, V> entry) throws GridException, IllegalStateException {
    A.notNull(entry, "entry");

    return addData(F.asList(entry));
  }
예제 #13
0
  /** {@inheritDoc} */
  @Override
  public GridFuture<?> addData(Map<K, V> entries) throws IllegalStateException {
    A.notNull(entries, "entries");

    return addData(entries.entrySet());
  }
예제 #14
0
  /** {@inheritDoc} */
  @Override
  public void perNodeBufferSize(int bufSize) {
    A.ensure(bufSize > 0, "bufSize > 0");

    this.bufSize = bufSize;
  }
예제 #15
0
  /** {@inheritDoc} */
  @Override
  public void updater(GridDataLoadCacheUpdater<K, V> updater) {
    A.notNull(updater, "updater");

    this.updater = updater;
  }