當前位置: 首頁>>代碼示例>>Java>>正文


Java Strings.randomBase64UUID方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.Strings.randomBase64UUID方法的典型用法代碼示例。如果您正苦於以下問題:Java Strings.randomBase64UUID方法的具體用法?Java Strings.randomBase64UUID怎麽用?Java Strings.randomBase64UUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.Strings的用法示例。


在下文中一共展示了Strings.randomBase64UUID方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startVerification

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:21,代碼來源:BlobStoreRepository.java

示例2: markStoreCorrupted

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
/**
 * 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));
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:23,代碼來源:Store.java

示例3: generateNodeId

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
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();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:DiscoveryService.java

示例4: build

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
public ClusterState build() {
    if (UNKNOWN_UUID.equals(uuid)) {
        uuid = Strings.randomBase64UUID();
    }
    // if local node is the master node, then should not using any settings from any tenants
    if (!nodes.localNodeMaster()) {
        metaData.updateSettingsByNode(nodes.localNode());
    }
    ClusterState newState = new ClusterState(clusterName, version, uuid, metaData, routingTable, nodes, blocks, customs.build(), fromDiff);
    return newState;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:12,代碼來源:ClusterState.java

示例5: newInitializing

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
/**
 * Creates a new allocation id for initializing allocation.
 */
public static AllocationId newInitializing() {
    return new AllocationId(Strings.randomBase64UUID(), null);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:7,代碼來源:AllocationId.java

示例6: generateClusterUuidIfNeeded

import org.elasticsearch.common.Strings; //導入方法依賴的package包/類
public Builder generateClusterUuidIfNeeded() {
    if (clusterUUID.equals("_na_")) {
        clusterUUID = Strings.randomBase64UUID();
    }
    return this;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:7,代碼來源:MetaData.java


注:本文中的org.elasticsearch.common.Strings.randomBase64UUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。