org.elasticsearch.common.Strings.randomBase64UUID()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(64)

本文整理了Java中org.elasticsearch.common.Strings.randomBase64UUID()方法的一些代码示例,展示了Strings.randomBase64UUID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.randomBase64UUID()方法的具体详情如下:
包路径:org.elasticsearch.common.Strings
类名称:Strings
方法名:randomBase64UUID

Strings.randomBase64UUID介绍

[英]Returns a Base64 encoded version of a Version 4.0 compatible UUID as defined here: http://www.ietf.org/rfc/rfc4122.txt, using a private SecureRandom instance
[中]返回与4.0版兼容的UUID的Base64编码版本,定义如下:http://www.ietf.org/rfc/rfc4122.txt,使用私有SecureRandom实例

代码示例

代码示例来源:origin: fujitsu-pio/io

/**
   * ランダムなUUIDを返す.
   * @return UUID
   */
  public static String randomUUID() {
    return Strings.randomBase64UUID();
  }
}

代码示例来源:origin: harbby/presto-connectors

public Builder generateClusterUuidIfNeeded() {
  if (clusterUUID.equals("_na_")) {
    clusterUUID = Strings.randomBase64UUID();
  }
  return this;
}

代码示例来源:origin: harbby/presto-connectors

public static String generateNodeId(Settings settings) {
    String seed = settings.get(DiscoveryService.SETTING_DISCOVERY_SEED);
    if (seed != null) {
      return Strings.randomBase64UUID(new Random(Long.parseLong(seed)));
    }
    return Strings.randomBase64UUID();
  }
}

代码示例来源:origin: fujitsu-pio/io

@Override
@SuppressWarnings("rawtypes")
public DcIndexResponse create(final Map data) {
  String id = Strings.randomBase64UUID();
  return this.create(id, data);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Creates a new allocation id for initializing allocation.
 */
public static AllocationId newInitializing() {
  return new AllocationId(Strings.randomBase64UUID(), null);
}

代码示例来源:origin: harbby/presto-connectors

public ClusterState build() {
  if (UNKNOWN_UUID.equals(uuid)) {
    uuid = Strings.randomBase64UUID();
  }
  return new ClusterState(clusterName, version, uuid, metaData, routingTable, nodes, blocks, customs.build(), fromDiff);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Creates a new allocation id for a shard that moves to be relocated, populating
 * the transient holder for relocationId.
 */
public static AllocationId newRelocation(AllocationId allocationId) {
  assert allocationId.getRelocationId() == null;
  return new AllocationId(allocationId.getId(), Strings.randomBase64UUID());
}

代码示例来源:origin: harbby/presto-connectors

public static Settings processSettings(Settings settings) {
  if (settings.get(TRIBE_NAME) != null) {
    // if its a node client started by this service as tribe, remove any tribe group setting
    // to avoid recursive configuration
    Settings.Builder sb = Settings.builder().put(settings);
    for (String s : settings.getAsMap().keySet()) {
      if (s.startsWith("tribe.") && !s.equals(TRIBE_NAME)) {
        sb.remove(s);
      }
    }
    return sb.build();
  }
  Map<String, Settings> nodesSettings = settings.getGroups("tribe", true);
  if (nodesSettings.isEmpty()) {
    return settings;
  }
  // its a tribe configured node..., force settings
  Settings.Builder sb = Settings.builder().put(settings);
  sb.put("node.client", true); // this node should just act as a node client
  sb.put("discovery.type", "local"); // a tribe node should not use zen discovery
  sb.put("discovery.initial_state_timeout", 0); // nothing is going to be discovered, since no master will be elected
  if (sb.get("cluster.name") == null) {
    sb.put("cluster.name", "tribe_" + Strings.randomBase64UUID()); // make sure it won't join other tribe nodes in the same JVM
  }
  sb.put(TransportMasterNodeReadAction.FORCE_LOCAL_SETTING, true);
  return sb.build();
}

代码示例来源:origin: harbby/presto-connectors

private void validateAndAddTemplate(final PutRequest request, IndexTemplateMetaData.Builder templateBuilder, IndicesService indicesService,
                      MetaDataCreateIndexService metaDataCreateIndexService) throws Exception {
  Index createdIndex = null;
  final String temporaryIndexName = Strings.randomBase64UUID();
  try {
      .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
      .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
      .put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID())
      .build();

代码示例来源:origin: harbby/presto-connectors

translogUUID = Strings.randomBase64UUID();
} else {
  translogUUID = translogGeneration.translogUUID;

代码示例来源:origin: harbby/presto-connectors

@Override
public String startVerification() {
  try {
    if (readOnly()) {
      // It's readonly - so there is not much we can do here to verify it
      return null;
    } else {
      String seed = Strings.randomBase64UUID();
      byte[] testBytes = Strings.toUTF8Bytes(seed);
      BlobContainer testContainer = blobStore().blobContainer(basePath().add(testBlobPrefix(seed)));
      String blobName = "master.dat";
      testContainer.writeBlob(blobName + "-temp", new BytesArray(testBytes));
      // Make sure that move is supported
      testContainer.move(blobName + "-temp", blobName);
      return seed;
    }
  } catch (IOException exp) {
    throw new RepositoryVerificationException(repositoryName, "path " + basePath() + " is not accessible on master node", exp);
  }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Marks this store as corrupted. This method writes a <tt>corrupted_${uuid}</tt> file containing the given exception
 * message. If a store contains a <tt>corrupted_${uuid}</tt> file {@link #isMarkedCorrupted()} will return <code>true</code>.
 */
public void markStoreCorrupted(IOException exception) throws IOException {
  ensureOpen();
  if (!isMarkedCorrupted()) {
    String uuid = CORRUPTED + Strings.randomBase64UUID();
    try (IndexOutput output = this.directory().createOutput(uuid, IOContext.DEFAULT)) {
      CodecUtil.writeHeader(output, CODEC, VERSION);
      BytesStreamOutput out = new BytesStreamOutput();
      out.writeThrowable(exception);
      BytesReference bytes = out.bytes();
      output.writeVInt(bytes.length());
      output.writeBytes(bytes.array(), bytes.arrayOffset(), bytes.length());
      CodecUtil.writeFooter(output);
    } catch (IOException ex) {
      logger.warn("Can't mark store as corrupted", ex);
    }
    directory().sync(Collections.singleton(uuid));
  }
}

代码示例来源:origin: harbby/presto-connectors

indexSettingsBuilder.put(SETTING_INDEX_UUID, Strings.randomBase64UUID());

代码示例来源:origin: harbby/presto-connectors

createIndexService.validateIndexSettings(renamedIndex, snapshotIndexMetaData.getSettings());
IndexMetaData.Builder indexMdBuilder = IndexMetaData.builder(snapshotIndexMetaData).state(IndexMetaData.State.OPEN).index(renamedIndex);
indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID()));
if (!request.includeAliases() && !snapshotIndexMetaData.getAliases().isEmpty()) {

相关文章

微信公众号

最新文章

更多