当前位置: 首页>>代码示例>>Java>>正文


Java Cluster类代码示例

本文整理汇总了Java中com.hazelcast.core.Cluster的典型用法代码示例。如果您正苦于以下问题:Java Cluster类的具体用法?Java Cluster怎么用?Java Cluster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cluster类属于com.hazelcast.core包,在下文中一共展示了Cluster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(50, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

    config = mock(Config.class);
    when(config.findMapConfig(eq(REGION_NAME))).thenReturn(mapConfig);

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    cache = mock(RegionCache.class);

    region = new HazelcastTimestampsRegion<RegionCache>(instance, REGION_NAME, new Properties(), cache);
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:26,代码来源:HazelcastTimestampsRegionTest.java

示例2: setUp

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(maxSize, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

    config = mock(Config.class);
    when(config.findMapConfig(eq(REGION_NAME))).thenReturn(mapConfig);

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    region = new HazelcastQueryResultsRegion(instance, REGION_NAME, new Properties());
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:24,代码来源:HazelcastQueryResultsRegionTest.java

示例3: ClusterListener

import com.hazelcast.core.Cluster; //导入依赖的package包/类
public ClusterListener(Cluster cluster) {
    
    this.cluster = cluster;
    for (Member member : cluster.getMembers()) {
        clusterNodesInfo.put(member.getUuid(), 
                new HazelcastClusterNodeInfo(member, cluster.getClusterTime()));
    }
    
    C2SCache = CacheFactory.createCache(RoutingTableImpl.C2S_CACHE_NAME);
    anonymousC2SCache = CacheFactory.createCache(RoutingTableImpl.ANONYMOUS_C2S_CACHE_NAME);
    S2SCache = CacheFactory.createCache(RoutingTableImpl.S2S_CACHE_NAME);
    componentsCache = CacheFactory.createCache(RoutingTableImpl.COMPONENT_CACHE_NAME);

    sessionInfoCache = CacheFactory.createCache(SessionManager.C2S_INFO_CACHE_NAME);
    componentSessionsCache = CacheFactory.createCache(SessionManager.COMPONENT_SESSION_CACHE_NAME);
    multiplexerSessionsCache = CacheFactory.createCache(SessionManager.CM_CACHE_NAME);
    incomingServerSessionsCache = CacheFactory.createCache(SessionManager.ISS_CACHE_NAME);

    directedPresencesCache = CacheFactory.createCache(PresenceUpdateHandler.PRESENCE_CACHE_NAME);

    joinCluster();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:ClusterListener.java

示例4: ClusterListener

import com.hazelcast.core.Cluster; //导入依赖的package包/类
public ClusterListener(Cluster cluster) {
	
	this.cluster = cluster;
    for (Member member : cluster.getMembers()) {
        clusterNodesInfo.put(member.getUuid(), 
        		new HazelcastClusterNodeInfo(member, cluster.getClusterTime()));
    }
	
    C2SCache = CacheFactory.createCache(RoutingTableImpl.C2S_CACHE_NAME);
    anonymousC2SCache = CacheFactory.createCache(RoutingTableImpl.ANONYMOUS_C2S_CACHE_NAME);
    S2SCache = CacheFactory.createCache(RoutingTableImpl.S2S_CACHE_NAME);
    componentsCache = CacheFactory.createCache(RoutingTableImpl.COMPONENT_CACHE_NAME);

    sessionInfoCache = CacheFactory.createCache(SessionManager.C2S_INFO_CACHE_NAME);
    componentSessionsCache = CacheFactory.createCache(SessionManager.COMPONENT_SESSION_CACHE_NAME);
    multiplexerSessionsCache = CacheFactory.createCache(SessionManager.CM_CACHE_NAME);
    incomingServerSessionsCache = CacheFactory.createCache(SessionManager.ISS_CACHE_NAME);

    directedPresencesCache = CacheFactory.createCache(PresenceUpdateHandler.PRESENCE_CACHE_NAME);

    joinCluster();
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:23,代码来源:ClusterListener.java

示例5: createMockHazelcastInstance

import com.hazelcast.core.Cluster; //导入依赖的package包/类
private HazelcastInstance createMockHazelcastInstance(Member member, boolean returnMember, Exception getClusterException) {
    Set<Member> memberSet = new HashSet<Member>();
    memberSet.add(member);

    Cluster cluster = mock(Cluster.class);
    when(cluster.getMembers()).thenReturn(memberSet);
    when(cluster.getLocalMember()).thenReturn(returnMember ? member : null);

    HazelcastInstance hazelcastInstance = mock(HazelcastInstance.class);
    when(hazelcastInstance.getLocalEndpoint()).thenReturn(returnMember ? member : null);
    if (getClusterException == null) {
        when(hazelcastInstance.getCluster()).thenReturn(cluster);
    } else {
        when(hazelcastInstance.getCluster()).thenReturn(cluster).thenThrow(getClusterException);
    }

    return hazelcastInstance;
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:19,代码来源:HazelcastUtilsTest.java

示例6: checkConnected

import com.hazelcast.core.Cluster; //导入依赖的package包/类
private void checkConnected(){
	Cluster cluster = instance_.getCluster();
	if(cluster.getMembers().size() > 1 && !connected_){
		connected();
	} else if(connected_){
		disconnected();
	}
}
 
开发者ID:juleswhite,项目名称:CSX278,代码行数:9,代码来源:HazelcastTransport.java

示例7: testGetHazelcastAddress_withClientWorker_oldHazelcastVersion

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Test
public void testGetHazelcastAddress_withClientWorker_oldHazelcastVersion() {
    Cluster cluster = mock(Cluster.class);
    when(cluster.getLocalMember()).thenThrow(new UnsupportedOperationException("Client has no local member!"));

    hazelcastInstance = mock(HazelcastInstance.class);
    when(hazelcastInstance.getLocalEndpoint()).thenThrow(new NoSuchMethodError("expected exception"));
    when(hazelcastInstance.getCluster()).thenReturn(cluster);

    String address = getHazelcastAddress("javaclient", "172.16.16.1", hazelcastInstance);

    assertEquals("client:172.16.16.1", address);
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:14,代码来源:HazelcastUtilsTest.java

示例8: ClusterListener

import com.hazelcast.core.Cluster; //导入依赖的package包/类
public ClusterListener(Cluster cluster) {
	
	this.cluster = cluster;
    for (Member member : cluster.getMembers()) {
        clusterNodesInfo.put(member.getUuid(), 
        		new HazelcastClusterNodeInfo(member, cluster.getClusterTime()));
    }
	
    C2SCache = CacheFactory.createCache(RoutingTableImpl.C2S_CACHE_NAME);
    anonymousC2SCache = CacheFactory.createCache(RoutingTableImpl.ANONYMOUS_C2S_CACHE_NAME);
    S2SCache = CacheFactory.createCache(RoutingTableImpl.S2S_CACHE_NAME);
    componentsCache = CacheFactory.createCache(RoutingTableImpl.COMPONENT_CACHE_NAME);

    sessionInfoCache = CacheFactory.createCache(SessionManager.C2S_INFO_CACHE_NAME);
    componentSessionsCache = CacheFactory.createCache(SessionManager.COMPONENT_SESSION_CACHE_NAME);
    multiplexerSessionsCache = CacheFactory.createCache(SessionManager.CM_CACHE_NAME);
    incomingServerSessionsCache = CacheFactory.createCache(SessionManager.ISS_CACHE_NAME);

    directedPresencesCache = CacheFactory.createCache(PresenceUpdateHandler.PRESENCE_CACHE_NAME);

    addEntryListener(C2SCache, new CacheListener(this, C2SCache.getName()));
    addEntryListener(anonymousC2SCache, new CacheListener(this, anonymousC2SCache.getName()));
    addEntryListener(S2SCache, new CacheListener(this, S2SCache.getName()));
    addEntryListener(componentsCache, new ComponentCacheListener());

    addEntryListener(sessionInfoCache, new CacheListener(this, sessionInfoCache.getName()));
    addEntryListener(componentSessionsCache, new CacheListener(this, componentSessionsCache.getName()));
    addEntryListener(multiplexerSessionsCache, new CacheListener(this, multiplexerSessionsCache.getName()));
    addEntryListener(incomingServerSessionsCache, new CacheListener(this, incomingServerSessionsCache.getName()));

    addEntryListener(directedPresencesCache, new DirectedPresenceListener());

    joinCluster();
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:35,代码来源:ClusterListener.java

示例9: getCluster

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Override
public Cluster getCluster() {
    return null;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:5,代码来源:WebConfigurerIntTest.java

示例10: getCluster

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Nonnull @Override
public Cluster getCluster() {
    return getHazelcastInstance().getCluster();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:5,代码来源:AbstractJetInstance.java

示例11: masterAddress

import com.hazelcast.core.Cluster; //导入依赖的package包/类
private static Address masterAddress(Cluster cluster) {
    return cluster.getMembers().stream().findFirst()
                  .orElseThrow(() -> new IllegalStateException("No members found in cluster"))
                  .getAddress();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:6,代码来源:JetClientInstanceImpl.java

示例12: getCluster

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Nonnull @Override
public Cluster getCluster() {
    return instance.getCluster();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:5,代码来源:JetBootstrap.java

示例13: getCluster

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Override
public Cluster getCluster() {
  return getHazelcastInstance().getCluster();
}
 
开发者ID:Sabadios,项目名称:Cherry,代码行数:5,代码来源:HazelcastService.java

示例14: localMemberIsOldestMember

import com.hazelcast.core.Cluster; //导入依赖的package包/类
@Override
public boolean localMemberIsOldestMember() {
	Cluster cluster = getOurHazelcastInstance().getCluster();
	return cluster.getLocalMember() == cluster.getMembers().iterator().next();
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:6,代码来源:HazelcastCoordinationServices.java

示例15: getCluster

import com.hazelcast.core.Cluster; //导入依赖的package包/类
public Cluster getCluster() {
    return cache.getCluster();
}
 
开发者ID:zyclonite,项目名称:gw2live,代码行数:4,代码来源:HazelcastCache.java


注:本文中的com.hazelcast.core.Cluster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。