All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cloud.tianai.rpc.common.util.id.IdUtils Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
package cloud.tianai.rpc.common.util.id;

import java.util.UUID;

/**
 * Title: IdUtils
 * Description: ID工具包
 *
 * @author: 天爱有情
 * @date: 2018/11/20 14:39
 **/
public class IdUtils {

    /**
     * 主机和进程的机器码
     */
    private static final Sequence worker = new Sequence();

    public static long getNoRepetitionId() {
        return worker.nextId();
    }

    public static String getNoRepetitionIdStr() {
        return String.valueOf(worker.nextId());
    }

    /**
     * 

* 获取去掉"-" UUID *

*/ public static synchronized String get32uuid() { return UUID.randomUUID().toString().replace("-", ""); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy