Java Code Examples for org.infinispan.manager.EmbeddedCacheManager#stop()

The following examples show how to use org.infinispan.manager.EmbeddedCacheManager#stop() . 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: InfinispanConfiguration.java    From apicurio-registry with Apache License 2.0 4 votes vote down vote up
public void stop(@Disposes EmbeddedCacheManager manager) {
    manager.stop();
}
 
Example 2
Source File: L1SerializationIssueTest.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Test
public void testL1Bug() throws Exception {
    EmbeddedCacheManager node1 = null;
    EmbeddedCacheManager node2 = null;
    EmbeddedCacheManager node3 = null;

    try {

        node1 = createManager();
        Cache<String, Object> node1Cache = node1.getCache(CACHE_NAME);
        logger.info("Node1Cache started");

        node2 = createManager();
        Cache<String, Object> node2Cache = node2.getCache(CACHE_NAME);
        logger.info("Node2Cache started");

        node3 = createManager();
        Cache<String, Object> node3Cache = node3.getCache(CACHE_NAME);
        logger.info("Node3Cache started");

        // Put some items on node1
        writeItems(node1Cache);

        // Get all items on node2. This will save them to L1 cache on node2
        readItems(node2Cache);

        // See the great performance with L1 enabled as everything read from L1 cache and there are no remote calls at all
        //readItems(node2Cache);

        // Write and see worse performance with L1 enabled as every write needs to invalidate L1 cache on node2 too
        //writeItems(node1Cache);

        // Kill node3
        node3.stop();

        // Wait
        logger.infof("Stopped node3. Will wait %d milliseconds", TIME_BEFORE_RESTORE_NODE);
        Thread.sleep(TIME_BEFORE_RESTORE_NODE);

        // Start node3 again
        logger.info("Going to start node3 again");

        node3 = createManager();
        node3Cache = node3.getCache(CACHE_NAME);
        logger.info("Node3Cache started again");

        logger.info("Test finished successfuly");
    } finally {
        if (node1 != null) node1.stop();
        if (node2 != null) node2.stop();
        if (node3 != null) node3.stop();
    }
}