This package contains the main API for interacting with a cluster member group - this is the way to start a Coherence cluster within a single JVM and then interact with it as a storage disabled member or an Extend client.
This framework has the following motivations:public static void main(String[] args) { final String key = "123"; ClusterMemberGroup memberGroup = null; try { memberGroup = ClusterMemberGroupUtils.newBuilder() .setStorageEnabledCount(2) .buildAndConfigureForStorageDisabledClient(); final NamedCache cache = CacheFactory.getCache("test"); cache.put(key, "hello"); System.out.println(cache.get(key)); } finally { ClusterMemberGroupUtils.shutdownCacheFactoryThenClusterMemberGroups(memberGroup); } }
public class SimpleTest { private static ClusterMemberGroup memberGroup; @BeforeClass public static void beforeTests() { memberGroup = ClusterMemberGroupUtils.newBuilder() .setStorageEnabledCount(2) .buildAndConfigureForStorageDisabledClient(); } @AfterClass public static void afterTests() { ClusterMemberGroupUtils.shutdownCacheFactoryThenClusterMemberGroups(memberGroup); } @Test public void simpleExample() { NamedCache cache = CacheFactory.getCache("test"); cache.put("key", "hello"); assertEquals(1, cache.size()); } }
... @Test public void clusterWithVarietyOfMembers() { memberGroup = ClusterMemberGroupUtils.newBuilder() .setStorageEnabledCount(2) .setExtendProxyCount(1) .setJmxMonitorCount(1) .buildAndConfigureForExtendClient(); // Perform test }