com.hazelcast.core.HazelcastInstance Java Examples

The following examples show how to use com.hazelcast.core.HazelcastInstance. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicTestCase.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Test
public void test_simple_sequencer_initialization_declarative()
        throws Exception {

    ClassLoader classLoader = BasicTestCase.class.getClassLoader();
    InputStream stream = classLoader.getResourceAsStream("hazelcast-node-configuration.xml");
    Config config = new XmlConfigBuilder(stream).build();

    TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
    HazelcastInstance hazelcastInstance = factory.newHazelcastInstance(config);

    try {
        Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
        SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);

        assertNotNull(sequencer);
    } finally {
        factory.shutdownAll();
    }
}
 
Example #2
Source File: TimeToLiveExample.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args ) throws FileNotFoundException, InterruptedException
{
   Config config = new Config();
   HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
   
   IMap<String,String> map = hazelcastInstance.getMap("TimeToLiveMap");
   
   map.put("hola", "tu", 10, TimeUnit.SECONDS);
   
   while (true){
      Thread.sleep(1000);
      String dato =map.get("hola");
      if (null!=dato){
         System.out.println(dato);
      } else {
         break;
      }
   }
   System.out.println("Data expired");
}
 
Example #3
Source File: ServerFoo.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
public void boot(String[] args) throws Exception {
    // create and embed the hazelcast server
    // (you can use the hazelcast client if you want to connect to external hazelcast server)
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();

    main = new Main();
    main.bind("hz", hz);

    if (args.length == 0) {
        // route which uses get/put operations
        main.addRouteBuilder(new CounterRoute("Foo", 8080));
    } else {
        // route which uses atomic counter
        main.addRouteBuilder(new AtomicCounterRoute("Foo", 8080));
    }
    main.run();
}
 
Example #4
Source File: BasicTestCase.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Test(expected = SnowcastStateException.class)
public void test_id_generation_in_detached_state()
        throws Exception {

    TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
    HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();

    try {
        Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
        SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);

        assertNotNull(sequencer);
        assertNotNull(sequencer.next());

        // Detach the node and free the currently used logical node ID
        sequencer.detachLogicalNode();

        sequencer.next();
    } finally {
        factory.shutdownAll();
    }
}
 
Example #5
Source File: CacheConfiguration.java    From flair-engine with Apache License 2.0 6 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Hazelcast");
    HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("fbiengine");
    if (hazelCastInstance != null) {
        log.debug("Hazelcast already initialized");
        return hazelCastInstance;
    }
    Config config = new Config();
    config.setInstanceName("fbiengine");
    config.getNetworkConfig().setPort(5701);
    config.getNetworkConfig().setPortAutoIncrement(true);

    // In development, remove multicast auto-configuration
    if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
        System.setProperty("hazelcast.local.localAddress", "127.0.0.1");

        config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
    }
    config.getMapConfigs().put("default", initializeDefaultMapConfig());
    config.getMapConfigs().put("com.fbi.engine.domain.*", initializeDomainMapConfig(jHipsterProperties));
    return Hazelcast.newHazelcastInstance(config);
}
 
Example #6
Source File: TimeSeriesMiniCubeManagerHzImpl.java    From minicubes with Apache License 2.0 6 votes vote down vote up
private void handleNewMember(HazelcastInstance instance, Member member) {
    
    // Relationship between Member and MiniCube ID
    IMap<String, String> miniCubeManager = instance.getMap(MINICUBE_MANAGER);
    LOGGER.info("Minicube manager status {}", ObjectUtils.getDisplayString(miniCubeManager));
    
    String key = member.getSocketAddress().toString();
    // FIXME: load-pending status need refactor
    instance.getCluster().getLocalMember().setBooleanAttribute("load-pending", false);
    
    if (miniCubeManager.containsKey(key) && !miniCubeManager.get(key).startsWith("?")) {
        // Maybe node-restart
        LOGGER.info("A node{} restarted, so we need rebuild cube{}", key, miniCubeManager.get(key));
        // Reassign task.
        reassignRole(miniCubeManager.get(key), miniCubeManager.get(key).split("::")[0]);
    } else {
        // First time join into cluster
        String id = "?" + "::" + hzGroupName + "@" + key;
        miniCubeManager.put(key, id);
        
        member.setStringAttribute("cubeId", id);
        LOGGER.info("Add {} into cluster {}", id, hzGroupName);
    }
    LOGGER.info("Set load-pending status to false, enable reassign feature on {}", member);
}
 
Example #7
Source File: BasicTestCase.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Test
public void test_sequencer_timestamp()
        throws Exception {

    TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
    HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();

    try {
        Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
        SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);

        int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(128);
        int shifting = calculateLogicalNodeShifting(boundedNodeCount);
        long sequence = generateSequenceId(10000, 10, 100, shifting);

        assertEquals(10000, sequencer.timestampValue(sequence));
    } finally {
        factory.shutdownAll();
    }
}
 
Example #8
Source File: TopicManager.java    From mercury with Apache License 2.0 6 votes vote down vote up
private void createTopic(String topic) {
    if (!topicExists(topic)) {
        String now = Utility.getInstance().date2str(new Date(), true);
        String nodes = HazelcastSetup.NAMESPACE+NODES;
        String realTopic = HazelcastSetup.NAMESPACE+topic;
        HazelcastInstance client = HazelcastSetup.getHazelcastClient();
        IMap<String, byte[]> map = client.getMap(nodes);
        Map<String, String> metadata = new HashMap<>();
        metadata.put("node", topic);
        metadata.put("name", Platform.getInstance().getName());
        metadata.put("created", now);
        metadata.put("updated", now);
        try {
            map.put(topic, msgPack.pack(metadata));
            // create topic if not exists
            client.getReliableTopic(realTopic);
            log.info("Topic {} created", realTopic);
        } catch (IOException e) {
            // this does not happen
            log.error("Unable to create topic {} - {}", topic, e.getMessage());
        }
    }
}
 
Example #9
Source File: Hazelcast4Driver.java    From hazelcast-simulator with Apache License 2.0 6 votes vote down vote up
public static void warmupPartitions(HazelcastInstance hazelcastInstance) {
    LOGGER.info("Waiting for partition warmup");

    PartitionService partitionService = hazelcastInstance.getPartitionService();
    long started = System.nanoTime();
    for (Partition partition : partitionService.getPartitions()) {
        if (System.nanoTime() - started > PARTITION_WARMUP_TIMEOUT_NANOS) {
            throw new IllegalStateException("Partition warmup timeout. Partitions didn't get an owner in time");
        }

        while (partition.getOwner() == null) {
            LOGGER.debug("Partition owner is not yet set for partitionId: " + partition.getPartitionId());
            sleepMillisThrowException(PARTITION_WARMUP_SLEEP_INTERVAL_MILLIS);
        }
    }

    LOGGER.info("Partitions are warmed up successfully");
}
 
Example #10
Source File: ServiceNode.java    From hazelcast-demo with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// 获取Hazelcast实例
	HazelcastInstance ins = Hazelcast.newHazelcastInstance();

	// 从集群中读取Map实例
	Map<Integer, String> map = ins.getMap("default map");

	// 向集群中添加数据
	System.out.println("Begin insert data");
	map.put(1, "Cait Cassiopeia");
	map.put(2, "Annie");
	map.put(3, "Evelynn");
	map.put(4, "Ashe");
	System.out.println("End");
	
}
 
Example #11
Source File: HazelcastScheduler.java    From greycat with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    Config cfg = new Config();
    HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
    Map<Integer, String> mapCustomers = instance.getMap("customers");
    mapCustomers.put(1, "Joe");
    mapCustomers.put(2, "Ali");
    mapCustomers.put(3, "Avi");

    System.out.println("Customer with key 1: "+ mapCustomers.get(1));
    System.out.println("Map Size:" + mapCustomers.size());

    Queue<String> queueCustomers = instance.getQueue("customers");
    queueCustomers.offer("Tom");
    queueCustomers.offer("Mary");
    queueCustomers.offer("Jane");
    System.out.println("First customer: " + queueCustomers.poll());
    System.out.println("Second customer: "+ queueCustomers.peek());
    System.out.println("Queue size: " + queueCustomers.size());
}
 
Example #12
Source File: TestCustomerSerializers.java    From subzero with Apache License 2.0 6 votes vote down vote up
@Test
public void testGlobalCustomSerializationConfiguredProgrammaticallyForClientConfig() {
    Config memberConfig = new Config();
    SubZero.useAsGlobalSerializer(memberConfig);
    hazelcastFactory.newHazelcastInstance(memberConfig);

    String mapName = randomMapName();
    ClientConfig config = new ClientConfig();

    SubZero.useAsGlobalSerializer(config, MyGlobalUserSerlizationConfig.class);

    HazelcastInstance member = hazelcastFactory.newHazelcastClient(config);
    IMap<Integer, AnotherNonSerializableObject> myMap = member.getMap(mapName);
    myMap.put(0, new AnotherNonSerializableObject());
    AnotherNonSerializableObject fromCache = myMap.get(0);

    assertEquals("deserialized", fromCache.name);
}
 
Example #13
Source File: UKTools.java    From youkefu with Apache License 2.0 5 votes vote down vote up
/**
 * 选出新的 Master服务器
 * @param hazelcastInstance
 */
public static void voteMaster(HazelcastInstance hazelcastInstance) {
	Set<Member> members = hazelcastInstance.getCluster().getMembers() ;
   	Member master = null ;
   	for(Member member : members) {
   		if(master == null || (member!=null && member.getLongAttribute("start")!=null && member.getLongAttribute("start") < master.getLongAttribute("start"))) {
   			master = member ;
   		}
   	}
   	if(master!=null) {
   		hazelcastInstance.getTopic(UKDataContext.UCKeFuTopic.TOPIC_VOTE.toString()).publish(new RPCDataBean(master.getStringAttribute("id"), master.getAddress().getHost(), master.getAddress().getPort() , master.getLongAttribute("start")));
   	}
}
 
Example #14
Source File: SubscriptionMain.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void main(String[] args){
    Config config = new Config();
    GlobalSerializerConfig globalConfig = new GlobalSerializerConfig();
    globalConfig.setOverrideJavaSerialization(true).setImplementation(new DataSerializer());

    config.getSerializationConfig().setGlobalSerializerConfig(globalConfig);

   HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);

   IMap<String, String> aMap = instance.getMap("aMap");

   aMap.addEntryListener(new MyListener(), true);

   
   aMap.put("key", "value");
   aMap.put("key", "Another value");
   aMap.remove("key");
   aMap.put("other key", "other value");
   aMap.clear();


   IMap<String, Data> otherMap = instance.getMap("otherMap");

   otherMap.addEntryListener(new MyListener(), true);
   otherMap.put("key", new Data());
   Data data = otherMap.get("key");
   data.date=new Date();
   data.value=1000;
   otherMap.put("key",data);

   instance.shutdown();
}
 
Example #15
Source File: HazelcastTestUtils.java    From hazelcast-simulator with Apache License 2.0 5 votes vote down vote up
public static void waitClusterSize(org.apache.log4j.Logger logger, HazelcastInstance hz, int clusterSize) {
    for (; ; ) {
        if (hz.getCluster().getMembers().size() >= clusterSize) {
            return;
        }

        logger.info("waiting cluster == " + clusterSize);
        sleepSeconds(1);
    }
}
 
Example #16
Source File: HazelcastHttpSessionConfigurationTests.java    From spring-session with Apache License 2.0 5 votes vote down vote up
@Bean
@SpringSessionHazelcastInstance
HazelcastInstance qualifiedHazelcastInstance() {
	HazelcastInstance hazelcastInstance = mock(HazelcastInstance.class);
	given(hazelcastInstance.getMap(anyString())).willReturn(qualifiedHazelcastInstanceSessions);
	return hazelcastInstance;
}
 
Example #17
Source File: AtomicExample.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void produce(HazelcastInstance hazelcastInstance) {
   IQueue<String> cola = hazelcastInstance.getQueue("cola");
   
   int count=0;
   while (true){
      try {
         cola.offer(Integer.toString(count++));
         Thread.sleep(1000);
         System.out.println("Added to queue. It has now "+cola.size());
      } catch (InterruptedException e) {
         e.printStackTrace();
      }
   }
}
 
Example #18
Source File: HazelcastGetStartServerSlave.java    From hazelcast-demo with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	//创建一个 hazelcastInstance实例
	HazelcastInstance instance = Hazelcast.newHazelcastInstance();
	Map<Integer, String> clusterMap = instance.getMap("MyMap");
	Queue<String> clusterQueue = instance.getQueue("MyQueue");
	
	System.out.println("Map Value:" + clusterMap.get(1));
	System.out.println("Queue Size :" + clusterQueue.size());
	System.out.println("Queue Value 1:" + clusterQueue.poll());
	System.out.println("Queue Value 2:" + clusterQueue.poll());
	System.out.println("Queue Size :" + clusterQueue.size());
}
 
Example #19
Source File: HazelcastHttpSessionConfigurationTests.java    From spring-session with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
HazelcastInstance primaryHazelcastInstance() {
	HazelcastInstance hazelcastInstance = mock(HazelcastInstance.class);
	given(hazelcastInstance.getMap(anyString())).willReturn(primaryHazelcastInstanceSessions);
	return hazelcastInstance;
}
 
Example #20
Source File: TransactionAwareConfig.java    From hazelcastmq with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance transactionAwareHazelcast() {
  TransactionAwareHazelcastInstanceProxyFactory factory =
      new TransactionAwareHazelcastInstanceProxyFactory(hazelcast(), true);

  return factory.create();
}
 
Example #21
Source File: ClientBasicTestCase.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Test
public void test_id_generation_in_reattached_state()
        throws Exception {

    Hazelcast.newHazelcastInstance(config);
    HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);

    try {
        Snowcast snowcast = SnowcastSystem.snowcast(client);
        SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);

        assertNotNull(sequencer);
        assertNotNull(sequencer.next());

        // Detach the node and free the currently used logical node ID
        sequencer.detachLogicalNode();

        try {
            // Must fail since we're in detached state!
            sequencer.next();
            fail();
        } catch (SnowcastStateException e) {
            // Expected, so ignore
        }

        // Re-attach the node and assign a free logical node ID
        sequencer.attachLogicalNode();

        assertNotNull(sequencer.next());
    } finally {
        HazelcastClient.shutdownAll();
        Hazelcast.shutdownAll();
    }
}
 
Example #22
Source File: SerializerTest.java    From subzero with Apache License 2.0 5 votes vote down vote up
@Test
public void givenSingleSerializerExist_whenHazelcastInstanceIsInjected_thenTypeIdIsGreaterThenZero() {
    Serializer serializer = new Serializer();
    serializer.setHazelcastInstance(newMockHazelcastInstance());

    HazelcastInstance hz = newMockHazelcastInstance();
    serializer.setHazelcastInstance(hz);

    int typeId = serializer.getTypeId();
    assertTrue(typeId > 0);
}
 
Example #23
Source File: CacheConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Hazelcast");
    HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("uaa");
    if (hazelCastInstance != null) {
        log.debug("Hazelcast already initialized");
        return hazelCastInstance;
    }
    Config config = new Config();
    config.setInstanceName("uaa");
    config.getNetworkConfig().setPort(5701);
    config.getNetworkConfig().setPortAutoIncrement(true);

    // In development, remove multicast auto-configuration
    if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
        System.setProperty("hazelcast.local.localAddress", "127.0.0.1");

        config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
    }
    config.getMapConfigs().put("default", initializeDefaultMapConfig());

    // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
    config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
    config.getMapConfigs().put("com.wyy.domain.*", initializeDomainMapConfig(jHipsterProperties));
    return Hazelcast.newHazelcastInstance(config);
}
 
Example #24
Source File: CacheConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Hazelcast");
    HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("umm");
    if (hazelCastInstance != null) {
        log.debug("Hazelcast already initialized");
        return hazelCastInstance;
    }
    Config config = new Config();
    config.setInstanceName("umm");
    config.getNetworkConfig().setPort(5701);
    config.getNetworkConfig().setPortAutoIncrement(true);

    // In development, remove multicast auto-configuration
    if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
        System.setProperty("hazelcast.local.localAddress", "127.0.0.1");

        config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
    }
    config.getMapConfigs().put("default", initializeDefaultMapConfig());

    // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
    config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
    config.getMapConfigs().put("com.wyy.domain.*", initializeDomainMapConfig(jHipsterProperties));
    return Hazelcast.newHazelcastInstance(config);
}
 
Example #25
Source File: ClientSnowcast.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Nonnull
private HazelcastClientInstanceImpl getHazelcastClient(@Nonnull HazelcastInstance hazelcastInstance) {
    //ACCESSIBILITY_HACK
    return ExceptionUtils.execute(() -> {
        // Ugly hack due to lack in SPI
        Field clientField = HazelcastClientProxy.class.getDeclaredField("client");
        clientField.setAccessible(true);
        return (HazelcastClientInstanceImpl) clientField.get(hazelcastInstance);
    }, RETRIEVE_CLIENT_ENGINE_FAILED);
}
 
Example #26
Source File: ServiceCacheConfiguration.java    From iotplatform with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance() {
    Config config = new Config();

    if (zkEnabled) {
        addZkConfig(config);
    }

    config.addMapConfig(createDeviceCredentialsCacheConfig());

    return Hazelcast.newHazelcastInstance(config);
}
 
Example #27
Source File: KeyUtils.java    From hazelcast-simulator with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if a key is located on a Hazelcast instance.
 *
 * @param instance the HazelcastInstance the key should belong to
 * @param key      the key to check
 * @return <tt>true</tt> if the key belongs to the Hazelcast instance, <tt>false</tt> otherwise
 */
public static boolean isLocalKey(HazelcastInstance instance, Object key) {
    PartitionService partitionService = instance.getPartitionService();
    Partition partition = partitionService.getPartition(key);
    Member owner;
    while (true) {
        owner = partition.getOwner();
        if (owner != null) {
            break;
        }
        sleepSeconds(1);
    }
    return owner.equals(instance.getLocalEndpoint());
}
 
Example #28
Source File: MapStoreExampleMain.java    From hazelcast-demo with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws FileNotFoundException {
	//加载配置
	Config config = new ClasspathXmlConfig("org/palm/hazelcast/map/store/mapStoreConfig.xml");
	//创建Hazelcast实力
	HazelcastInstance ins = Hazelcast.newHazelcastInstance(config);
	//获取Map
	Map<Integer, String> map = ins.getMap("demo");
	println(map.get(1));//输出第一条数据
	
	map.put(11, "Moonbrook");//添加一条数据
	println(map.get(11));//输出第一条数据
	
	map.remove(11);//移除添加的数据
	println(map.get(11));//输出被移除的数据
}
 
Example #29
Source File: IndexDocTests.java    From spring-session with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("unused")
void newHazelcastIndexedSessionRepository() {
	// tag::new-hazelcastindexedsessionrepository[]

	Config config = new Config();

	// ... configure Hazelcast ...

	HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);

	HazelcastIndexedSessionRepository repository = new HazelcastIndexedSessionRepository(hazelcastInstance);
	// end::new-hazelcastindexedsessionrepository[]
}
 
Example #30
Source File: SnowcastSequenceUtilsTestCase.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Test
public void test_comparator_first_higher_by_counter()
        throws Exception {

    TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
    HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();

    try {
        Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
        SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);

        int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
        int shifting = calculateLogicalNodeShifting(boundedNodeCount);
        long sequence1 = generateSequenceId(10000, 1, 2, shifting);
        long sequence2 = generateSequenceId(10000, 1, 1, shifting);

        Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);

        assertEquals(1, comparator.compare(sequence1, sequence2));
    } finally {
        factory.shutdownAll();
    }
}