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


Java IdGenerator类代码示例

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


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

示例1: service

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
@Override
public String service() {
	IdGenerator idgen = ClusterDataFactory.INSTANCE.createIdGenerator("CLIENT_ID_GENERATOR");

	String clientId = null;
	while (clientId == null) {
		clientId = String.format("laniClientId%011d", idgen.newId());

		if (Session.NEXUS.get(clientId) != null) {
			clientId = null;
		}
	}

	return String.format("{\"id\":\"%s\"}", clientId);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:16,代码来源:Clients.java

示例2: createIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
public IdGenerator createIdGenerator(String name) {
	switch (Settings.INSTANCE.clusteringMode()) {
	case HAZELCAST:
		return Hazelcast.INSTANCE.getIdGenerator(name);

	case IGNITE:
	case SINGLE:
		return new SingleIdGenerator(name);

	default:
		return null;
	}
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:14,代码来源:ClusterDataFactory.java

示例3: getIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
@Override
public IdGenerator getIdGenerator(String value) {
    if (idGenerators.get(value) == null) {
        synchronized (this) {
            if (idGenerators.get(value) == null) {
                return this.hazelcastInstance.getIdGenerator(value);
            }
        }
    }
    return idGenerators.get(value);
}
 
开发者ID:sastix,项目名称:cms,代码行数:12,代码来源:HazelcastDistributedLockManager.java

示例4: getUID

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
@Override
public String getUID(String region) {
    CRC32 CRC_32 = new CRC32();
    LOG.info("HazelcastCacheService->GET_UID");
    IdGenerator idGenerator = cm.getIdGenerator(region);
    final String uid = String.valueOf(idGenerator.newId()); //assures uniqueness during the life cycle of the cluster
    final String uuid = UUID.randomUUID().toString();
    String ret = new StringBuilder(uuid).append(region).append(uid).toString();
    CRC_32.reset();
    CRC_32.update(ret.getBytes());
    return Long.toHexString(CRC_32.getValue());
}
 
开发者ID:sastix,项目名称:cms,代码行数:13,代码来源:HazelcastCacheService.java

示例5: getIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
@Override
public IdGenerator getIdGenerator(String name)
{
    name = Objects.requireNonNull(name);

    final IdGenerator valu = getBeanSafely(name, IdGenerator.class);

    if (null != valu)
    {
        return valu;
    }
    return hz().getIdGenerator(name);
}
 
开发者ID:ahome-it,项目名称:ahome-tooling-server-hazelcast,代码行数:14,代码来源:HazelcastContextInstance.java

示例6: getDataId

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
public Long getDataId() {
    if (this.dataId == null) {
        IdGenerator idGen = hazelcastInstance.getIdGenerator("dataId");
        this.dataId = idGen.newId();
    }
    return this.dataId;
}
 
开发者ID:bgokden,项目名称:predictblty,代码行数:8,代码来源:MLAlgorithm.java

示例7: start

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void start(ClusterManager manager) throws AndesException{
    this.manager = manager;

    /**
     * register topic listeners for cluster events. This has to be done
     * after initializing Andes Stores and Manager classes
     */
    //TODO: review
    //HazelcastAgent.getInstance().addTopicListeners();

    Member localMember = hazelcastInstance.getCluster().getLocalMember();
    nodeIdMap.set(localMember.getSocketAddress().toString(), getLocalNodeIdentifier());

    checkForDuplicateNodeId(localMember);

    // Generate a unique id for this node for message id generation
    IdGenerator idGenerator = this.hazelcastInstance.getIdGenerator(
            CoordinationConstants.HAZELCAST_ID_GENERATOR_NAME);
    this.uniqueIdOfLocalMember = (int) idGenerator.newId();
    if (log.isDebugEnabled()) {
        log.debug("Unique ID generation for message ID generation:" + uniqueIdOfLocalMember);
    }

    String thriftCoordinatorServerIP = AndesContext.getInstance().getThriftServerHost();
    int thriftCoordinatorServerPort = AndesContext.getInstance().getThriftServerPort();
    InetSocketAddress thriftAddress = new InetSocketAddress(thriftCoordinatorServerIP, thriftCoordinatorServerPort);
    InetSocketAddress hazelcastAddress = hazelcastInstance.getCluster().getLocalMember().getSocketAddress();

    coordinationStrategy.start(this, getLocalNodeIdentifier(), thriftAddress,
            hazelcastAddress);

    networkPartitionDetector.start();
}
 
开发者ID:wso2,项目名称:andes,代码行数:38,代码来源:CoordinationConfigurableClusterAgent.java

示例8: getIdGenerator

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

示例9: getIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
protected IdGenerator getIdGenerator(String name) {
	return substance.getIdGenerator(name);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:4,代码来源:Hazelcast.java

示例10: HzGeneratorImpl

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
public HzGeneratorImpl(IdGenerator idGen) {
	this.idGen = idGen;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:4,代码来源:HzGeneratorImpl.java

示例11: getIdGenerator

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

示例12: startup

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
@Override
public void startup() {

	Config config = new Config();
	
	hazelcastInstance = Hazelcast.newHazelcastInstance(config );		

	logger.info("finished hz startup");
	IdGenerator idGen = hazelcastInstance.getIdGenerator("watchKeys");
	
	id = idGen.newId();
	logger.info("our id is {}",id);
	
			
}
 
开发者ID:oci-pronghorn,项目名称:FogLight-Examples,代码行数:16,代码来源:PhysicalWatcher.java

示例13: getIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
/**
 * Get specific id generator.
 *
 * @param value the specific context of id generator
 * @return id generator.
 */
IdGenerator getIdGenerator(String value);
 
开发者ID:sastix,项目名称:cms,代码行数:8,代码来源:DistributedLockManager.java

示例14: getIdGenerator

import com.hazelcast.core.IdGenerator; //导入依赖的package包/类
public IdGenerator getIdGenerator(String name); 
开发者ID:ahome-it,项目名称:ahome-tooling-server-hazelcast,代码行数:2,代码来源:IHazelcastContext.java


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