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

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

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

origin: org.infinispan/infinispan-embedded-query

 @Override
 public boolean shouldModifyIndexes(FlagAffectedCommand command, InvocationContext ctx,
                   DistributionManager distributionManager, RpcManager rpcManager, Object key) {
   return command instanceof ClearCommand ||
      !(command.hasAnyFlag(FlagBitSets.SKIP_INDEXING)) &&
         (distributionManager == null || distributionManager.getCacheTopology().getDistribution(key).isWriteOwner());
 }
},
origin: org.infinispan/infinispan-query

 @Override
 public boolean shouldModifyIndexes(FlagAffectedCommand command, InvocationContext ctx,
                   DistributionManager distributionManager, RpcManager rpcManager, Object key) {
   if (key == null || distributionManager == null) {
    return true;
   }
   DistributionInfo info = distributionManager.getCacheTopology().getDistribution(key);
   // If this is a backup node we should modify the entry in the remote context
   return info.isPrimary() || info.isWriteOwner() &&
      (ctx.isInTxScope() || !ctx.isOriginLocal() || command != null && command.hasAnyFlag(FlagBitSets.PUT_FOR_STATE_TRANSFER));
 }
},
origin: org.infinispan/infinispan-core

  @Override
  public TestCache create(String groupName, List<Cache<GroupKey, String>> cacheList) {
   Cache<GroupKey, String> primaryOwner = null;
   AdvancedCache<GroupKey, String> backupOwner = null;
   for (Cache<GroupKey, String> cache : cacheList) {
     DistributionManager distributionManager = TestingUtil.extractComponent(cache, DistributionManager.class);
     DistributionInfo distributionInfo = distributionManager.getCacheTopology().getDistribution(groupName);
     if (primaryOwner == null && distributionInfo.isPrimary()) {
      primaryOwner = cache;
     } else if (backupOwner == null && distributionInfo.isWriteOwner()) {
      backupOwner = cache.getAdvancedCache();
     }
     if (primaryOwner != null && backupOwner != null) {
      return new TestCache(primaryOwner, backupOwner);
     }
   }
   throw new IllegalStateException("didn't find a cache... should never happen!");
  }
},
origin: org.infinispan/infinispan-core

  @Override
  public TestCache create(String groupName, List<Cache<GroupKey, String>> cacheList) {
   Cache<GroupKey, String> primaryOwner = null;
   AdvancedCache<GroupKey, String> nonOwner = null;
   for (Cache<GroupKey, String> cache : cacheList) {
     DistributionManager distributionManager = TestingUtil.extractComponent(cache, DistributionManager.class);
     DistributionInfo distributionInfo = distributionManager.getCacheTopology().getDistribution(groupName);
     if (primaryOwner == null && distributionInfo.isPrimary()) {
      primaryOwner = cache;
     } else if (nonOwner == null && !distributionInfo.isWriteOwner()) {
      nonOwner = cache.getAdvancedCache();
     }
     if (primaryOwner != null && nonOwner != null) {
      return new TestCache(primaryOwner, nonOwner);
     }
   }
   throw new IllegalStateException("didn't find a cache... should never happen!");
  }
};
origin: org.infinispan/infinispan-core

private void doTest(Operation operation, boolean init) throws Exception {
 final MagicKey key = new MagicKey(cache(1), cache(2));
 if (init) {
   cache(0).put(key, "v1");
   assertInAllCache(key, "v1");
 }
 BlockingLocalTopologyManager bltm0 = replaceTopologyManagerDefaultCache(manager(0));
 BlockingLocalTopologyManager bltm1 = replaceTopologyManagerDefaultCache(manager(1));
 killMember(2, null, false);
 //CH_UPDATE + REBALANCE_START + CH_UPDATE(blocked)
 bltm0.expectRebalanceStartAfterLeave().unblock();
 bltm1.expectRebalanceStartAfterLeave().unblock();
 bltm0.expectPhaseConfirmation().unblock();
 bltm1.expectPhaseConfirmation().unblock();
 //check if we are in the correct state
 LocalizedCacheTopology cacheTopology = TestingUtil.extractComponent(cache(0), DistributionManager.class).getCacheTopology();
 DistributionInfo distributionInfo = cacheTopology.getDistribution(key);
 assertFalse(distributionInfo.isReadOwner());
 assertTrue(distributionInfo.isWriteOwner());
 assertEquals(address(1), distributionInfo.primary());
 operation.put(key, "v2", cache(1));
 BlockingLocalTopologyManager.finishRebalance(CacheTopology.Phase.READ_ALL_WRITE_ALL, bltm0, bltm1);
 waitForClusterToForm(); //let the cluster finish the state transfer
 assertInAllCache(key, "v2");
}
org.infinispan.distributionDistributionInfoisWriteOwner

Popular methods of DistributionInfo

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

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • JCheckBox (javax.swing)
  • Top PhpStorm plugins
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