/** * @param hostInfo custom host information * @param pid a unique process identifier for the host machine */ public FixedUidGenerator(HostInfo hostInfo, String pid) { this.hostName = hostInfo == null ? null : hostInfo.getHostName(); this.pid = pid; }
/** * @param hostInfo custom host information * @param pid a unique process identifier for the host machine */ public FixedUidGenerator(HostInfo hostInfo, String pid) { this.hostName = hostInfo == null ? null : hostInfo.getHostName(); this.pid = pid; }
/** * @return a unique component identifier */ public Uid generateUid() { final StringBuilder b = new StringBuilder(); b.append(uniqueTimestamp()); b.append('-'); b.append(pid); if (hostInfo != null && hostInfo.getHostName() != null) { b.append('@'); b.append(hostInfo.getHostName()); } return new Uid(b.toString()); }
/** * @return a unique component identifier */ public Uid generateUid() { final StringBuffer b = new StringBuffer(); b.append(uniqueTimestamp()); b.append('-'); b.append(pid); if (hostInfo != null) { b.append('@'); b.append(hostInfo.getHostName()); } return new Uid(b.toString()); }
/** * @return a unique component identifier */ public Uid generateUid() { final StringBuilder b = new StringBuilder(); b.append(uniqueTimestamp()); b.append('-'); b.append(pid); if (hostInfo != null) { b.append('@'); b.append(hostInfo.getHostName()); } return new Uid(b.toString()); }