/** {@inheritDoc} */
  @Override
  public R get(long timeout, TimeUnit unit) throws IgniteCheckedException {
    A.ensure(timeout >= 0, "timeout cannot be negative: " + timeout);
    A.notNull(unit, "unit");

    try {
      return get0(unit.toNanos(timeout));
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();

      throw new IgniteInterruptedCheckedException(
          "Got interrupted while waiting for future to complete.", e);
    }
  }
예제 #2
0
  /**
   * Sets given values starting at {@code 0} position.
   *
   * @param v Values to set.
   */
  public void set(Object... v) {
    A.ensure(v.length <= vals.length, "v.length <= vals.length");

    if (v.length > 0) System.arraycopy(v, 0, vals, 0, v.length);
  }
예제 #3
0
  /**
   * Sets value at given index.
   *
   * @param i Index to set.
   * @param v Value to set.
   * @param <V> Value type.
   */
  public <V> void set(int i, V v) {
    A.ensure(i < vals.length, "i < vals.length");

    vals[i] = v;
  }
예제 #4
0
  /**
   * Retrieves value at given index.
   *
   * @param i Index of the value to get.
   * @param <V> Value type.
   * @return Value at given index.
   */
  @SuppressWarnings({"unchecked"})
  public <V> V get(int i) {
    A.ensure(i < vals.length, "i < vals.length");

    return (V) vals[i];
  }
예제 #5
0
  /**
   * Initializes tuple with given object count.
   *
   * @param cnt Count of objects to be stored in the tuple.
   */
  public GridTupleV(int cnt) {
    A.ensure(cnt > 0, "cnt > 0");

    vals = new Object[cnt];
  }
예제 #6
0
  /**
   * Sets given values starting at provided position in the tuple.
   *
   * @param pos Position to start from.
   * @param v Values to set.
   */
  public void set(int pos, Object... v) {
    A.ensure(pos > 0, "pos > 0");
    A.ensure(v.length + pos <= vals.length, "v.length + pos <= vals.length");

    if (v.length > 0) System.arraycopy(v, 0, vals, pos, v.length);
  }