congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BasicSingleProducerEnforcer.enable
Code IndexAdd Tabnine to your IDE (free)

How to use
enable
method
in
com.netflix.hollow.api.producer.enforcer.BasicSingleProducerEnforcer

Best Java code snippets using com.netflix.hollow.api.producer.enforcer.BasicSingleProducerEnforcer.enable (Showing top 4 results out of 315)

origin: Netflix/hollow

@Test
public void testEnableDisable() {
  BasicSingleProducerEnforcer se = new BasicSingleProducerEnforcer();
  Assert.assertTrue(se.isPrimary());
  se.disable();
  Assert.assertFalse(se.isPrimary());
  se.enable();
  Assert.assertTrue(se.isPrimary());
}
origin: Netflix/hollow

@Test
public void testMultiCycle() {
  BasicSingleProducerEnforcer se = new BasicSingleProducerEnforcer();
  for (int i = 0; i < 10; i++) {
    se.enable();
    Assert.assertTrue(se.isPrimary());
    se.onCycleStart(1234L);
    se.disable();
    Assert.assertTrue(se.isPrimary());
    se.onCycleComplete(null, 10L, TimeUnit.SECONDS);
    Assert.assertFalse(se.isPrimary());
  }
}
origin: Netflix/hollow

@Test
public void testNotPrimaryProducerVersion() {
  BasicSingleProducerEnforcer enforcer = new BasicSingleProducerEnforcer();
  HollowProducer producer = HollowProducer.withPublisher(new FakeBlobPublisher())
      .withSingleProducerEnforcer(enforcer)
      .withAnnouncer(new HollowFilesystemAnnouncer(tmpFolder.toPath()))
      .build();
  producer.addListener(new FakeProducerListener());
  long v1 = producer.runCycle(ws -> {
    ws.add(1);
  });
  enforcer.disable();
  // Run cycle as not the primary producer
  long v2 = producer.runCycle(ws -> {
    ws.add(1);
  });
  // Run cycle as the primary producer
  enforcer.enable();
  long v3 = producer.runCycle(ws -> {
    ws.add(2);
  });
  Assert.assertEquals(v1, v2);
  Assert.assertTrue(v3 > v2);
}
origin: Netflix/hollow

@Test
public void testTransitions() {
  BasicSingleProducerEnforcer se = new BasicSingleProducerEnforcer();
  Assert.assertTrue(se.isPrimary());
  se.onCycleStart(1234L);
  Assert.assertTrue(se.isPrimary());
  se.disable();
  Assert.assertTrue(se.isPrimary());
  se.onCycleComplete(null, 10L, TimeUnit.SECONDS);
  Assert.assertFalse(se.isPrimary());
  se.enable();
  Assert.assertTrue(se.isPrimary());
  se.onCycleStart(1235L);
  Assert.assertTrue(se.isPrimary());
  se.disable();
  Assert.assertTrue(se.isPrimary());
  se.onCycleComplete(null, 10L, TimeUnit.SECONDS);
  Assert.assertFalse(se.isPrimary());
}
com.netflix.hollow.api.producer.enforcerBasicSingleProducerEnforcerenable

Popular methods of BasicSingleProducerEnforcer

  • <init>
  • disable
  • isPrimary
  • onCycleComplete
  • onCycleStart

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • putExtra (Intent)
  • setContentView (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • 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