Tabnine Logo
DistributionInfo.writeOwners
Code IndexAdd Tabnine to your IDE (free)

How to use
writeOwners
method
in
org.infinispan.distribution.DistributionInfo

Best Java code snippets using org.infinispan.distribution.DistributionInfo.writeOwners (Showing top 11 results out of 315)

origin: org.infinispan/infinispan-core

if (di.writeOwners().contains(ownerAddress)) {
  return valueToTest;
if (di.writeOwners().contains(ownerAddress)) {
  return valueToTest;
origin: org.infinispan/infinispan-core

private void assertOwnershipConsensus(String key) {
 List l1 = getCacheTopology(c1).getDistribution(key).writeOwners();
 List l2 = getCacheTopology(c2).getDistribution(key).writeOwners();
 List l3 = getCacheTopology(c3).getDistribution(key).writeOwners();
 List l4 = getCacheTopology(c4).getDistribution(key).writeOwners();
 assertEquals("L1 "+l1+" and L2 "+l2+" don't agree.", l1, l2);
 assertEquals("L2 "+l2+" and L3 "+l3+" don't agree.", l2, l3);
 assertEquals("L3 "+l3+" and L4 "+l4+" don't agree.", l3, l4);
}
origin: org.infinispan/infinispan-core

protected void assertMapsToAddress(Object o, Address addr) {
 LocalizedCacheTopology cacheTopology = caches.get(0).getAdvancedCache().getDistributionManager().getCacheTopology();
 List<Address> addresses = cacheTopology.getDistribution(o).writeOwners();
 assertEquals("Expected key " + o + " to map to address " + addr + ". List of addresses is" + addresses, true, addresses.contains(addr));
}
origin: org.infinispan/infinispan-core

@Test (dependsOnMethods = "testServersDropped")
public void testCollocatedKey() {
 LocalizedCacheTopology cacheTopology =
    manager(0).getCache(cacheName).getAdvancedCache().getDistributionManager().getCacheTopology();
 for (int i = 0; i < 1000; i++) {
   List<Address> addresses = cacheTopology.getDistribution(i).writeOwners();
   Object collocatedKey = keyAffinityService.getCollocatedKey(i);
   List<Address> addressList = cacheTopology.getDistribution(collocatedKey).writeOwners();
   assertEquals(addresses, addressList);
 }
}
origin: org.infinispan/infinispan-core

private void assertOwnership(String key) {
 for (Cache<?, ?> cache : caches()) {
   Collection<Address> writeOwners = cache.getAdvancedCache().getDistributionManager().getCacheTopology()
      .getDistribution(key).writeOwners();
   assertEquals(Arrays.asList(address(1), address(2)), writeOwners);
 }
}
origin: org.infinispan/infinispan-query

private Optional<Cache<Object, Person>> findCache(Ownership ownership, Object key) {
 List<Cache<Object, Person>> caches = caches();
 ClusteringDependentLogic cdl = cache1.getAdvancedCache().getComponentRegistry().getComponent(ClusteringDependentLogic.class);
 DistributionInfo distribution = cdl.getCacheTopology().getDistribution(key);
 Predicate<Cache<?, ?>> predicate = null;
 switch (ownership) {
   case PRIMARY:
    predicate = c -> c.getAdvancedCache().getRpcManager().getAddress().equals(distribution.primary());
    break;
   case BACKUP:
    predicate = c -> distribution.writeBackups().contains(c.getAdvancedCache().getRpcManager().getAddress());
    break;
   case NON_OWNER:
    predicate = c -> !distribution.writeOwners().contains(c.getAdvancedCache().getRpcManager().getAddress());
 }
 return caches.stream().filter(predicate).findFirst();
}
origin: org.infinispan/infinispan-cli-interpreter

@Override
public Result execute(Session session) throws StatementException {
 Cache<Object, Object> cache = session.getCache(keyData.getCacheName());
 Codec codec = session.getCodec();
 if (options.size() > 0) {
   for (Option option : options) {
    switch (option.toEnum(Options.class)) {
    case CODEC: {
      if (option.getParameter() == null) {
       throw log.missingOptionParameter(option.getName());
      } else {
       codec = session.getCodec(option.getParameter());
      }
    }
    }
   }
 }
 DistributionManager distributionManager = cache.getAdvancedCache().getDistributionManager();
 if(distributionManager!=null) {
   Object key = keyData.getKey();
   Collection<Address> addresses = distributionManager.getCacheTopology()
                            .getDistribution(codec.encodeKey(key)).writeOwners();
   return new StringResult(addresses.toString());
 } else {
   throw log.cacheNotDistributed();
 }
}
origin: org.infinispan/infinispan-core

private <K> void assertExistence(final K key) {
 LocalizedCacheTopology cacheTopology =
    cache(addresses[0]).getAdvancedCache().getDistributionManager().getCacheTopology();
 final List<Address> addresses = cacheTopology.getDistribution(key).writeOwners();
 log.debug(key + " should be present on = " + addresses);
 eventuallyEquals(2, () -> caches().stream().mapToInt(c -> c.getAdvancedCache().getDataContainer().containsKey(key) ? 1 : 0).sum());
 for (Cache<? super K, ?> c : caches()) {
   if (cacheMode.isScattered()) {
    eventuallyEquals("Failure for key " + key + " on cache " + address(c), true,
       () -> addresses.contains(address(c)) ? c.getAdvancedCache().getDataContainer().containsKey(key) : true);
   } else {
    eventuallyEquals("Failure for key " + key + " on cache " + address(c), addresses.contains(address(c)),
       () -> c.getAdvancedCache().getDataContainer().containsKey(key));
   }
 }
}
origin: org.infinispan/infinispan-hibernate-cache-commons

List<Address> owners = cacheTopology.getDistribution(command.getKey()).writeOwners();
if (owners.contains(rpcManager.getAddress())) {
  return invokeNextAndHandle( ctx, command, (rCtx, rCommand, rv, throwable) ->
origin: org.infinispan/infinispan-core

private <K, V> CacheHelper<K, V> create(List<Cache<K, V>> cacheList) {
 CacheHelper<K, V> cacheHelper = new CacheHelper<>();
 for (Cache<K, V> cache : cacheList) {
   ClusteringDependentLogic clusteringDependentLogic = extractComponent(cache, ClusteringDependentLogic.class);
   DistributionInfo distributionInfo = clusteringDependentLogic.getCacheTopology().getDistribution(key);
   log.debugf("owners for key %s are %s", key, distributionInfo.writeOwners());
   if (distributionInfo.isPrimary()) {
    log.debug("Cache " + address(cache) + " is the primary owner");
    assertTrue(cacheHelper.addCache(Ownership.PRIMARY, cache));
   } else if (distributionInfo.isWriteBackup()) {
    log.debug("Cache " + address(cache) + " is the backup owner");
    assertTrue(cacheHelper.addCache(Ownership.BACKUP, cache));
   } else {
    log.debug("Cache " + address(cache) + " is the non owner");
    assertTrue(cacheHelper.addCache(Ownership.NON_OWNER, cache) || cacheMode.isScattered());
   }
 }
 return cacheHelper;
}
origin: org.infinispan/infinispan-core

       dm0.getCacheTopology().getPendingCH().locateOwnersForSegment(0));
assertEquals(Arrays.asList(address(1), address(2), address(3), address(0)),
       dm0.getCacheTopology().getDistribution("k1").writeOwners());
org.infinispan.distributionDistributionInfowriteOwners

Popular methods of DistributionInfo

  • isPrimary
  • primary
  • isWriteOwner
  • isReadOwner
  • isWriteBackup
  • readOwners
  • writeBackups
  • writeOwnership

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • putExtra (Intent)
  • findViewById (Activity)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now