Codota Logo
ClusterGroup.forRandom
Code IndexAdd Codota to your IDE (free)

How to use
forRandom
method
in
org.apache.ignite.cluster.ClusterGroup

Best Java code snippets using org.apache.ignite.cluster.ClusterGroup.forRandom (Showing top 5 results out of 315)

  • Common ways to obtain ClusterGroup
private void myMethod () {
ClusterGroup c =
  • Codota IconIgnite ignite;ignite.cluster().forRemotes()
  • Codota IconIgnite ignite;ignite.cluster().forServers()
  • Smart code suggestions by Codota
}
origin: apache/ignite

/**
 * @param loc Enforce local.
 * @return Local node cluster group.
 */
private ClusterGroup projection(boolean loc) {
  GridCacheContext<K, V> ctx = getContextSafe();
  if (loc || ctx.isLocal() || ctx.isReplicatedAffinityNode())
    return ctx.kernalContext().grid().cluster().forLocal();
  if (ctx.isReplicated())
    return ctx.kernalContext().grid().cluster().forDataNodes(cacheName).forRandom();
  return null;
}
origin: apache/ignite

/**
 * Compares checksums between primary and backup partitions of specified caches.
 * Works properly only on idle cluster - there may be false positive conflict reports if data in cluster is being
 * concurrently updated.
 *
 * @param ig Ignite instance.
 * @param caches Cache names (if null, all user caches will be verified).
 * @return Conflicts result.
 * @throws IgniteException If none caches or node found.
 */
protected IdleVerifyResultV2 idleVerify(Ignite ig, String... caches) {
  IgniteEx ig0 = (IgniteEx)ig;
  Set<String> cacheNames = new HashSet<>();
  if (F.isEmpty(caches))
    cacheNames.addAll(ig0.cacheNames());
  else
    Collections.addAll(cacheNames, caches);
  if (cacheNames.isEmpty())
    throw new IgniteException("None cache for checking.");
  ClusterNode node = !ig0.localNode().isClient() ? ig0.localNode() : ig0.cluster().forServers().forRandom().node();
  if (node == null)
    throw new IgniteException("None server node for verification.");
  VisorIdleVerifyTaskArg taskArg = new VisorIdleVerifyTaskArg(cacheNames);
  return ig.compute().execute(
    VisorIdleVerifyTaskV2.class.getName(),
    new VisorTaskArgument<>(node.id(), taskArg, false)
  );
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testEmptyGroup() throws Exception {
  ClusterGroup emptyGrp = ignite.cluster().forAttribute("nonExistent", "val");
  assertEquals(0, emptyGrp.forOldest().nodes().size());
  assertEquals(0, emptyGrp.forYoungest().nodes().size());
  assertEquals(0, emptyGrp.forAttribute("nonExistent2", "val").nodes().size());
  assertEquals(0, emptyGrp.forCacheNodes("cacheName").nodes().size());
  assertEquals(0, emptyGrp.forClientNodes("cacheName").nodes().size());
  assertEquals(0, emptyGrp.forClients().nodes().size());
  assertEquals(0, emptyGrp.forDaemons().nodes().size());
  assertEquals(0, emptyGrp.forDataNodes("cacheName").nodes().size());
  assertEquals(0, emptyGrp.forRandom().nodes().size());
  assertEquals(0, emptyGrp.forRemotes().nodes().size());
  assertEquals(0, emptyGrp.forServers().nodes().size());
  assertEquals(0, emptyGrp.forHost(ignite.cluster().localNode()).nodes().size());
  assertEquals(0, emptyGrp.forHost("127.0.0.1").nodes().size());
}
origin: apache/ignite

  /**
   * @throws Exception If failed.
   */
  @Test
  public void testSerializeClosure() throws Exception {
    Ignite client = ignite(CLIENT);

    final IgniteCache<Integer, Integer> clientCache = client.createCache(cacheConfiguration(PARTITIONED, ATOMIC));

    try {
      client.compute(client.cluster().forRemotes().forRandom()).call(new IgniteCallable<Object>() {
        @Override public Object call() throws Exception {
          clientCache.withKeepBinary();
          clientCache.withSkipStore();

          return null;
        }
      });
    }
    finally {
      client.destroyCache(DEFAULT_CACHE_NAME);
    }
  }
}
origin: org.apache.ignite/ignite-core

/**
 * @param loc Enforce local.
 * @return Local node cluster group.
 */
private ClusterGroup projection(boolean loc) {
  if (loc || ctx.isLocal() || ctx.isReplicatedAffinityNode())
    return ctx.kernalContext().grid().cluster().forLocal();
  if (ctx.isReplicated())
    return ctx.kernalContext().grid().cluster().forDataNodes(ctx.name()).forRandom();
  return null;
}
org.apache.ignite.clusterClusterGroupforRandom

Javadoc

Creates a cluster group with one random node from the current cluster group.

Popular methods of ClusterGroup

  • nodes
    Gets the read-only collection of nodes in this cluster group.
  • node
    Gets a node for given ID from this cluster group.
  • forPredicate
    Creates a new cluster group which includes all nodes that pass the given predicate filter.
  • forAttribute
    Creates a new cluster group for nodes containing given name and value specified in user attributes.
  • forClients
    Creates a cluster group of nodes started in client mode.
  • forDataNodes
    Creates a cluster group for all data nodes that have the cache with the specified name running.
  • forNodeIds
    Creates a cluster group over nodes with specified node IDs.
  • forRemotes
    Gets cluster group consisting from the nodes in this cluster group excluding the local node.
  • forServers
    Creates a cluster group of nodes started in server mode.
  • hostNames
    Gets the read-only collection of hostnames in this cluster group.
  • ignite
    Gets instance of grid.
  • metrics
    Gets a metrics snapshot for this cluster group.
  • ignite,
  • metrics,
  • predicate,
  • forCacheNodes,
  • forClientNodes,
  • forDaemons,
  • forHost,
  • forNodeId,
  • forOldest

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • getContentResolver (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now