org.apache.ignite.Ignition.localIgnite()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(93)

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

Ignition.localIgnite介绍

[英]This method is used to address a local Ignite instance, principally from closure.

According to contract this method has to be called only under IgniteThread. An IllegalArgumentException will be thrown otherwise.
[中]此方法用于处理本地Ignite实例,主要是来自闭包。
根据合同,此方法只能在IgniteThread下调用。否则将抛出IllegalArgumentException。

代码示例

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

/**
 * @return Object.
 */
@SuppressWarnings("unused")
private Object writeReplace() {
  ignite = Ignition.localIgnite();
  return this;
}

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

/**
 * @return Object.
 */
@SuppressWarnings("unused")
private Object readResolve() {
  ignite = Ignition.localIgnite();
  return this;
}

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

/**
 * @return Local ignite.
 */
protected Ignite ignite() {
  return Ignition.localIgnite();
}

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

/**
   * Returns task metadata storage that is kept by every node in the cluster.
   *
   * @return Task metadata storage that is kept by every node in the cluster.
   */
  ConcurrentHashMap<UUID, Future<?>> getMetadataStorage() {
    Ignite ignite = Ignition.localIgnite();

    ConcurrentMap<String, ConcurrentHashMap<UUID, Future<?>>> nodeLocMap = ignite.cluster().nodeLocalMap();

    return nodeLocMap.computeIfAbsent(LONG_RUNNING_PROCESS_STORAGE_NAME, k -> new ConcurrentHashMap<>());
  }
}

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

/** {@inheritDoc} */
@Override public void init(ServiceContext ctx) {
  Ignite ignite = Ignition.localIgnite();
  reqQueue = ignite.queue(String.format(INFERENCE_REQUEST_QUEUE_NAME_PATTERN, suffix), QUEUE_CAPACITY,
    queueCfg);
  resQueue = ignite.queue(String.format(INFERENCE_RESPONSE_QUEUE_NAME_PATTERN, suffix), QUEUE_CAPACITY,
    queueCfg);
  mdl = parser.parse(reader.read());
}

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

/**
 * @param out Object output.
 * @throws IOException If fail.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
  U.writeString(out, val);
  ignite = Ignition.localIgnite();
}

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

/** {@inheritDoc} */
@Override public void writeExternal(final ObjectOutput out) throws IOException {
  U.writeString(out, val);
  ignite = Ignition.localIgnite();
}

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

/**
 * @param in Object input.
 * @throws IOException If fail.
 */
private void readObject(ObjectInputStream in) throws IOException {
  val = U.readString(in);
  ignite = Ignition.localIgnite();
}

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

/** {@inheritDoc} */
@Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  val = U.readString(in);
  ignite = Ignition.localIgnite();
}

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

/** {@inheritDoc} */
@Override public <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
  String upstreamCacheName = upstreamCache.getName();
  String datasetCacheName = datasetCache.getName();
  return computeForAllPartitions(part -> {
    LearningEnvironment env = ComputeUtils.getLearningEnvironment(ignite, datasetId, part, envBuilder);
    C ctx = ComputeUtils.getContext(Ignition.localIgnite(), datasetCacheName, part);
    D data = ComputeUtils.getData(
      Ignition.localIgnite(),
      upstreamCacheName,
      filter,
      upstreamTransformerBuilder,
      datasetCacheName,
      datasetId,
      partDataBuilder,
      env,
      upstreamKeepBinary
    );
    if (data != null) {
      R res = map.apply(ctx, data, env);
      // Saves partition context after update.
      ComputeUtils.saveContext(Ignition.localIgnite(), datasetCacheName, part, ctx);
      return res;
    }
    return null;
  }, reduce, identity);
}

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

@Override public void run() {
    startLatch.countDown();
    try {
      startLatch.await();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    //busy spinning after waking up from startLatch.await
    // to reduce probability that one thread starts significantly earlier than the other
    while (!busySpinFlag) {
      if (trickCompilerVar.get() < 0)
        break;
    }
    Ignition.localIgnite().cache(DEFAULT_CACHE_NAME).put(1, aOrg1);
  }
});

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

/** {@inheritDoc} */
@Override public <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
  String upstreamCacheName = upstreamCache.getName();
  String datasetCacheName = datasetCache.getName();
  return computeForAllPartitions(part -> {
    LearningEnvironment env = ComputeUtils.getLearningEnvironment(Ignition.localIgnite(), datasetId, part, envBuilder);
    D data = ComputeUtils.getData(
      Ignition.localIgnite(),
      upstreamCacheName,
      filter,
      upstreamTransformerBuilder,
      datasetCacheName,
      datasetId,
      partDataBuilder,
      env,
      upstreamKeepBinary
    );
    return data != null ? map.apply(data, env) : null;
  }, reduce, identity);
}

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

@Override public void run() {
    startLatch.countDown();
    try {
      startLatch.await();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    //busy spinning after waking up from startLatch.await
    // to reduce probability that one thread starts significantly earlier than the other
    while (!busySpinFlag) {
      if (trickCompilerVar.get() < 0)
        break;
    }
    Ignition.localIgnite().cache(DEFAULT_CACHE_NAME).put(2, bOrg2);
  }
});

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

/** {@inheritDoc} */
@Override public void readBinary(final BinaryReader reader) throws BinaryObjectException {
  val = reader.rawReader().readString();
  ignite = Ignition.localIgnite();
}

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

/** {@inheritDoc} */
@Override public void writeBinary(final BinaryWriter writer) throws BinaryObjectException {
  writer.rawWriter().writeString(val);
  ignite = Ignition.localIgnite();
}

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

final IgniteEx locIgnite = (IgniteEx)Ignition.localIgnite();

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

Ignite ignite = Ignition.localIgnite();

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

boolean isKeepBinary) {
affinityCallWithRetries(ignite, Arrays.asList(datasetCacheName, upstreamCacheName), part -> {
  Ignite locIgnite = Ignition.localIgnite();
  LearningEnvironment env = envBuilder.buildForWorker(part);

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

boolean ret = Ignition.localIgnite().cache("testCache").containsKey(node.id().toString());

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ignite

@Override
public void start() {
  try {
    localNode = Thread.currentThread() instanceof IgniteThread; // vk: take local node instance
    if ( localNode ) {
      cacheManager = (IgniteEx) Ignition.localIgnite();
      gridName = cacheManager.name();
    }
    else {
      IgniteConfiguration conf = createIgniteConfiguration( configProvider );
      gridName = gridName( configProvider.getInstanceName(), configProvider.getUrl(), conf );
      startIgnite( conf );
    }
  }
  catch (ServiceException ex) {
    throw ex;
  }
  catch (Exception ex) {
    throw log.unableToStartDatastoreProvider( ex );
  }
}

相关文章