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

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

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

Ignite.configuration介绍

[英]Gets the configuration of this Ignite instance.

NOTE:
SPIs obtains through this method should never be used directly. SPIs provide internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via this method to check its configuration properties or call other non-SPI methods.
[中]获取此Ignite实例的配置。
注:
通过该方法获得的SPI不得直接使用。SPI提供子系统的内部视图,由Ignite内核在内部使用。在少数情况下,当需要访问此SPI的特定实现时,可以通过此方法获取此SPI的实例,以检查其配置属性或调用其他非SPI方法。

代码示例

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

/**
 * @param zipBytes Zip-compressed bytes.
 * @return Unmarshalled object.
 * @throws IgniteCheckedException If failed.
 */
private <T> T unmarshalZip(byte[] zipBytes) throws Exception {
  assert zipBytes != null && zipBytes.length > 0;
  InflaterInputStream in = new InflaterInputStream(new ByteArrayInputStream(zipBytes));
  return marsh.unmarshal(in, U.resolveClassLoader(spi.ignite().configuration()));
}

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

/**
 * @return {@code True} if ssl enabled.
 */
boolean isSslEnabled() {
  return ignite().configuration().getSslContextFactory() != null;
}

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

@Override public Object call() {
    nodeId.set(ignite.configuration().getNodeId());
    return null;
  }
});

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

/**
 * @param node Node.
 * @return Node's discovery SPI.
 */
static ZookeeperDiscoverySpi spi(Ignite node) {
  return (ZookeeperDiscoverySpi)node.configuration().getDiscoverySpi();
}

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

/**
 * @param ignite Node.
 * @return Node's communication SPI.
 */
static ZkTestCommunicationSpi testSpi(Ignite ignite) {
  return (ZkTestCommunicationSpi)ignite.configuration().getCommunicationSpi();
}

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

/**
 * @param ignite Node.
 * @return Discovery SPI.
 */
protected static TestTcpDiscoverySpi spi(Ignite ignite) {
  return ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi());
}

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

/**
 * Checks whether a cache should be undeployed in SHARED or CONTINUOUS modes.
 *
 * @param g Ignite node.
 * @return {@code true} if the cache has to be undeployed, {@code false} otherwise.
 */
protected boolean isCacheUndeployed(Ignite g) {
  return !(g.configuration().getMarshaller() instanceof BinaryMarshaller);
}

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

@Override public Object call() throws Exception {
    pingLatch.countDown();
    pingRes.set(pingingNode.configuration().getDiscoverySpi().pingNode(
      failedNodeId));
    return null;
  }
}, 1);

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

/** {@inheritDoc} */
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
  @Nullable String arg) {
  for (ClusterNode node : subgrid)
    if (node.id().equals(ignite.configuration().getNodeId()))
      return Collections.singletonMap(new ComputeJobAdapter() {
        @Override public Serializable execute() {
          return null;
        }
      }, node);
  throw new IgniteException("Local node not found.");
}

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

/**
   * Skip messages will not send anymore.
   */
  public static void skipMsgType(Ignite ignite, Class clazz) {
    ((TestTcpCommunicationSpi)ignite.configuration().getCommunicationSpi()).stop(clazz);
  }
}

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

/**
 * @return {@code True} if nodes use {@link TcpDiscoverySpi}.
 */
protected static boolean tcpDiscovery() {
  List<Ignite> nodes = G.allGrids();
  assertFalse("There are no nodes", nodes.isEmpty());
  return nodes.get(0).configuration().getDiscoverySpi() instanceof TcpDiscoverySpi;
}

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

/**
 * @param ignite Node.
 * @param near Near cache flag.
 * @return Communication SPI.
 */
private TestRecordingCommunicationSpi recordGetRequests(Ignite ignite, boolean near) {
  TestRecordingCommunicationSpi spi =
    (TestRecordingCommunicationSpi)ignite.configuration().getCommunicationSpi();
  spi.record(near ? GridNearGetRequest.class : GridNearSingleGetRequest.class);
  return spi;
}

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

/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
  System.setProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL, "true");
  super.beforeTestsStarted();
  startGrids(SRVS);
  for (int i = 0; i < CLIENTS; i++) {
    client.set(true);
    Ignite client = startGrid(SRVS);
    assertTrue(client.configuration().isClientMode());
  }
}

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

@SuppressWarnings("deprecation")
  @Override public Void call() throws Exception {
    ignite(0).configuration().getMarshaller().marshal(new C1());
    ignite(0).configuration().getMarshaller().marshal(new C2());
    return null;
  }
}, 64, "marshal");

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

/**
 * @return Client node.
 */
private Ignite clientIgnite() {
  Ignite ignite = ignite(NODE_CNT - 1);
  assertTrue(ignite.configuration().isClientMode());
  if (tcpDiscovery())
    assertEquals(clientDiscovery(), ignite.configuration().getDiscoverySpi().isClientMode());
  return ignite;
}

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

@Override public Void call() throws Exception {
    Ignite ignite = ignite(nodeIdx.getAndIncrement());
    log.info("Check get [node=" + ignite.name() +
      ", client=" + ignite.configuration().isClientMode() + ']');
    IgniteCache<Object, Object> cache = ignite.cache(ccfg.getName());
    while (U.currentTimeMillis() < stopTime)
      checkGet(cache);
    return null;
  }
}, SRVS + CLIENTS, "get-thread");

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

/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
  super.beforeTestsStarted();
  startGridsMultiThreaded(SRV_CNT);
  client = true;
  Ignite client = startGrid(SRV_CNT);
  assertTrue(client.configuration().isClientMode());
}

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

@Override public Object execute() {
    X.println("Executing FailoverTestTask job on node " + ignite.configuration().getNodeId());
    Boolean cpVal = ses.loadCheckpoint(CP_KEY);
    assert cpVal != null;
    if (cpVal) {
      ses.saveCheckpoint(CP_KEY, false);
      throw new ComputeExecutionRejectedException("Failing over the job.");
    }
    return null;
  }
},

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

/**
 * Consistent ID is not configured neither in the {@link IgniteConfiguration} nor via the JVM property.
 *
 * @throws Exception if failed.
 */
@Test
public void testConsistentIdNotConfigured() throws Exception {
  Ignite ignite = startGrid(0);
  assertNull(ignite.configuration().getConsistentId());
  assertTrue(ADDR_WITH_PORT_PATTERN.matcher(ignite.cluster().localNode().consistentId().toString()).find());
  info("Consistent ID: " + ignite.cluster().localNode().consistentId());
}

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

/** */
private void runRemoteUnmarshal() throws Exception {
  Ignite ignite = startGrid(0);
  byte[] one = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.ONE);
  byte[] two = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.TWO);
  startGrid(1);
  ignite.compute(ignite.cluster().forRemotes()).call(new UnmarshalCallable(one, two));
}

相关文章