org.apache.ignite.internal.util.typedef.F.wrap()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.apache.ignite.internal.util.typedef.F.wrap()方法的一些代码示例,展示了F.wrap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。F.wrap()方法的具体详情如下:
包路径:org.apache.ignite.internal.util.typedef.F
类名称:F
方法名:wrap

F.wrap介绍

暂无

代码示例

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean apply(E1 e1, E2 e2) {
  try {
    return applyx(e1, e2);
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R apply(E1 e1, E2 e2) {
  try {
    return applyx(e1, e2);
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void apply() {
  try {
    applyx();
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R apply(E e) {
  try {
    return applyx(e);
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R apply() {
  try {
    return applyx();
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R apply() {
  try {
    return applyx();
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean apply(E1 e1, E2 e2, E3 e3) {
  try {
    return applyx(e1, e2, e3);
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void apply(E1 e1, E2 e2) {
  try {
    applyx(e1, e2);
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R reduce() {
  try {
    return applyx();
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public T apply() {
  try {
    return applyx();
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void apply(E1 e1, E2 e2, E3 e3) {
  try {
    applyx(e1, e2, e3);
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean apply(E1 e) {
  try {
    return applyx(e);
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void apply(T t) {
  try {
    applyx(t);
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean apply() {
  try {
    return applyx();
  }
  catch (IgniteCheckedException ex) {
    throw F.wrap(ex);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public R apply(E1 e1, E2 e2, E3 e3) {
  try {
    return applyx(e1, e2, e3);
  }
  catch (IgniteCheckedException e) {
    throw F.wrap(e);
  }
}

代码示例来源:origin: apache/ignite

/**
 * Gets the value with given key. If that value does not exist, calls given
 * closure to get the default value, puts it into the map and returns it. If
 * closure is {@code null} return {@code null}.
 *
 * @param map Concurrent hash map.
 * @param key Key to get the value for.
 * @param c Default value producing closure.
 * @param <K> Key type.
 * @param <V> Value type.
 * @return Value for the key or the value produced by the closure if key
 *      does not exist in the map. Return {@code null} if key is not found and
 *      closure is {@code null}.
 */
public static <K, V>  V addIfAbsent(ConcurrentMap<K, V> map, K key, @Nullable Callable<V> c) {
  A.notNull(map, "map", key, "key");
  V v = map.get(key);
  if (v == null && c != null) {
    try {
      v = c.call();
    }
    catch (Exception e) {
      throw F.wrap(e);
    }
    V v0 = map.putIfAbsent(key, v);
    if (v0 != null)
      v = v0;
  }
  return v;
}

代码示例来源:origin: apache/ignite

/**
 * Adds given metadata value only if it was absent.
 *
 * @param key Metadata key.
 * @param c Factory closure to produce value to add if it's not attached already. Not that unlike {@link
 * #addMeta(int, Object)} method the factory closure will not be called unless the value is required and therefore
 * value will only be created when it is actually needed. If {@code null} and metadata value is missing - {@code
 * null} will be returned from this method.
 * @param <V> Type of the value.
 * @return The value of the metadata after execution of this method.
 */
@Nullable public <V> V addMetaIfAbsent(int key, @Nullable Callable<V> c) {
  assert c != null;
  synchronized (this) {
    V v = (V)meta(key);
    if (v == null && c != null)
      try {
        addMeta(key, v = c.call());
      }
      catch (Exception e) {
        throw F.wrap(e);
      }
    return v;
  }
}

代码示例来源:origin: apache/ignite

@Override public void apply() {
    int id = idx.getAndIncrement();
    try {
      log.info("Start node: " + id);
      startGrid(id);
      Thread.sleep(1000);
    }
    catch (Exception e) {
      throw F.wrap(e);
    }
    finally {
      stopGrid(id);
      info("Thread finished.");
    }
  }
}, threadCnt, "test-thread");

代码示例来源:origin: apache/ignite

@Override public void apply() {
    try {
      for (int i = 0; i < TOP_CHANGE_CNT; i++) {
        if (failed.get())
          return;
        Collection<String> names = new GridLeanSet<>(3);
        try {
          for (int j = 0; j < 3; j++) {
            if (failed.get())
              return;
            String name = UUID.randomUUID().toString();
            log.info("Start node: " + name);
            Ignite g = startGrid(name);
            names.add(name);
            cb.apply(g);
          }
        }
        finally {
          for (String name : names)
            stopGrid(name);
        }
      }
    }
    catch (Exception e) {
      if (failed.compareAndSet(false, true))
        throw F.wrap(e);
    }
  }
}, topChangeThreads, "topology-change-thread");

代码示例来源:origin: apache/ignite

@Override public void run() {
    try {
      assertEquals(TOP_CHANGE_THREAD_CNT * 3, startedNodes.size());
      for (String name : startedNodes) {
        stopGrid(name, false);
        awaitPartitionMapExchange();
      }
      startedNodes.clear();
      sem.release(TOP_CHANGE_THREAD_CNT);
      barrier.reset();
    }
    catch (Exception e) {
      if (failed.compareAndSet(false, true)) {
        sem.release(TOP_CHANGE_THREAD_CNT);
        barrier.reset();
        throw F.wrap(e);
      }
    }
  }
});

相关文章