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


Java BatchlogManager類代碼示例

本文整理匯總了Java中org.apache.cassandra.db.BatchlogManager的典型用法代碼示例。如果您正苦於以下問題:Java BatchlogManager類的具體用法?Java BatchlogManager怎麽用?Java BatchlogManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: decommission

import org.apache.cassandra.db.BatchlogManager; //導入依賴的package包/類
public void decommission() throws InterruptedException
{
    if (!tokenMetadata.isMember(FBUtilities.getBroadcastAddress()))
        throw new UnsupportedOperationException("local node is not a member of the token ring yet");
    if (tokenMetadata.cloneAfterAllLeft().sortedTokens().size() < 2)
        throw new UnsupportedOperationException("no other normal nodes in the ring; decommission would be pointless");

    PendingRangeCalculatorService.instance.blockUntilFinished();
    for (String keyspaceName : Schema.instance.getNonSystemKeyspaces())
    {
        if (tokenMetadata.getPendingRanges(keyspaceName, FBUtilities.getBroadcastAddress()).size() > 0)
            throw new UnsupportedOperationException("data is currently moving to this node; unable to leave the ring");
    }

    if (logger.isDebugEnabled())
        logger.debug("DECOMMISSIONING");
    startLeaving();
    long timeout = Math.max(RING_DELAY, BatchlogManager.instance.getBatchlogTimeout());
    setMode(Mode.LEAVING, "sleeping " + timeout + " ms for batch processing and pending range setup", true);
    Thread.sleep(timeout);

    Runnable finishLeaving = new Runnable()
    {
        public void run()
        {
            shutdownClientServers();
            Gossiper.instance.stop();
            MessagingService.instance().shutdown();
            StageManager.shutdownNow();
            setMode(Mode.DECOMMISSIONED, true);
            // let op be responsible for killing the process
        }
    };
    unbootstrap(finishLeaving);
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:36,代碼來源:StorageService.java

示例2: prepareToJoin

import org.apache.cassandra.db.BatchlogManager; //導入依賴的package包/類
private void prepareToJoin() throws ConfigurationException
{
    if (!joined)
    {
        Map<ApplicationState, VersionedValue> appStates = new HashMap<>();

        if (DatabaseDescriptor.isReplacing() && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
            throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
        if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
            throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");
        if (DatabaseDescriptor.isReplacing())
        {
            if (SystemKeyspace.bootstrapComplete())
                throw new RuntimeException("Cannot replace address with a node that is already bootstrapped");
            if (!DatabaseDescriptor.isAutoBootstrap())
                throw new RuntimeException("Trying to replace_address with auto_bootstrap disabled will not work, check your configuration");
            bootstrapTokens = prepareReplacementInfo();
            appStates.put(ApplicationState.TOKENS, valueFactory.tokens(bootstrapTokens));
            appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
        }
        else if (shouldBootstrap())
        {
            checkForEndpointCollision();
        }

        // have to start the gossip service before we can see any info on other nodes.  this is necessary
        // for bootstrap to get the load info it needs.
        // (we won't be part of the storage ring though until we add a counterId to our state, below.)
        // Seed the host ID-to-endpoint map with our own ID.
        UUID localHostId = SystemKeyspace.getLocalHostId();
        getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
        appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
        appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
        appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getBroadcastRpcAddress()));
        appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
        logger.info("Starting up server gossip");
        Gossiper.instance.register(this);
        Gossiper.instance.start(SystemKeyspace.incrementAndGetGeneration(), appStates); // needed for node-ring gathering.
        // gossip snitch infos (local DC and rack)
        gossipSnitchInfo();
        // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema UUID in preparation for updates

        if (!MessagingService.instance().isListening())
            MessagingService.instance().listen(FBUtilities.getLocalAddress());
        LoadBroadcaster.instance.startBroadcasting();

        HintedHandOffManager.instance.start();
        BatchlogManager.instance.start();
    }
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:52,代碼來源:StorageService.java


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