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

com.jeesuite.kafka.utils.NodeNameHolder Maven / Gradle / Ivy

There is a newer version: 1.3.6
Show newest version
/**
 * 
 */
package com.jeesuite.kafka.utils;

import java.net.InetAddress;
import java.util.UUID;

import org.apache.commons.lang3.RandomStringUtils;

/**
 * @description 
* @author vakin * @date 2016年11月3日 */ public class NodeNameHolder { private static String nodeId; public static String getNodeId() { if(nodeId != null)return nodeId; try { nodeId = InetAddress.getLocalHost().getHostName() + "_" + RandomStringUtils.random(6, true, true).toLowerCase(); } catch (Exception e) { nodeId = UUID.randomUUID().toString(); } return nodeId; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy