Package com.netflix.exhibitor.core.config

Examples of com.netflix.exhibitor.core.config.PseudoLock


    }

    @Override
    public PseudoLock newPseudoLock() throws Exception
    {
        return new PseudoLock()
        {
            @Override
            public boolean lock(ActivityLog log, long maxWait, TimeUnit unit) throws Exception
            {
                return true;
View Full Code Here


        InstanceConfig  wrapped = parseToConfig(newConfigJson);

        Result  result = null;
        try
        {
            PseudoLock  lock = context.getExhibitor().getConfigManager().newConfigBasedLock();
            try
            {
                if ( lock.lock(context.getExhibitor().getLog(), 10, TimeUnit.SECONDS) )  // TODO consider making configurable in the future
                {
                    if ( context.getExhibitor().getConfigManager().startRollingConfig(wrapped, null) )
                    {
                        result = new Result("OK", true);
                    }
                }
            }
            finally
            {
                lock.unlock();
            }

            if ( result == null )
            {
                result = new Result("Another process has updated the config.", false);
View Full Code Here

        InstanceConfig wrapped = parseToConfig(newConfigJson);

        Result  result = null;
        try
        {
            PseudoLock  lock = context.getExhibitor().getConfigManager().newConfigBasedLock();
            try
            {
                if ( lock.lock(context.getExhibitor().getLog(), 10, TimeUnit.SECONDS) )  // TODO consider making configurable in the future
                {
                    if ( context.getExhibitor().getConfigManager().updateConfig(wrapped) )
                    {
                        result = new Result("OK", true);
                    }
                }
            }
            finally
            {
                lock.unlock();
            }

            if ( result == null )
            {
                result = new Result(CANT_UPDATE_CONFIG_MESSAGE, false);
View Full Code Here

        {
            exhibitor.getLog().add(ActivityLog.Type.INFO, "Ensemble state is not yet stable. Automatic Instance Management will wait for stability.");
            return true;
        }

        PseudoLock lock = exhibitor.getConfigManager().newConfigBasedLock();
        try
        {
            if ( lock.lock(exhibitor.getLog(), Exhibitor.AUTO_INSTANCE_MANAGEMENT_PERIOD_MS / 2, TimeUnit.MILLISECONDS) )
            {
                ServerList potentialServerList = ensembleBuilder.createPotentialServerList();
                if ( !potentialServerList.equals(serverList) )  // otherwise, no change
                {
                    if ( potentialServerList.getSpecs().size() == 0 )
                    {
                        exhibitor.getLog().add(ActivityLog.Type.INFO, "Automatic Instance Management skipped because new potential server list is empty");
                    }
                    else
                    {
                        exhibitor.getLog().add(ActivityLog.Type.INFO, "Automatic Instance Management will change the server list: " + serverList + " ==> " + potentialServerList);
                        adjustConfig(potentialServerList.toSpecString(), clusterState.getLeaderHostname());
                    }
                }
            }
        }
        finally
        {
            lock.unlock();
        }

        return true;
    }
View Full Code Here

    }

    @Override
    public PseudoLock newPseudoLock() throws Exception
    {
        return new PseudoLock()
        {
            @Override
            public boolean lock(ActivityLog log, long maxWait, TimeUnit unit) throws Exception
            {
                return true;
View Full Code Here

TOP

Related Classes of com.netflix.exhibitor.core.config.PseudoLock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.