Package com.netflix.exhibitor.core.config

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


    @Path("get-state")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getSystemState(@Context Request request) throws Exception
    {
        InstanceConfig              config = context.getExhibitor().getConfigManager().getConfig();

        String                      response = new FourLetterWord(FourLetterWord.Word.RUOK, config, context.getExhibitor().getConnectionTimeOutMs()).getResponse();
        ServerList                  serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));
        ServerSpec                  us = Iterables.find(serverList.getSpecs(), ServerList.isUs(context.getExhibitor().getThisJVMHostname()), null);

        ObjectNode                  mainNode = JsonNodeFactory.instance.objectNode();
        ObjectNode                  configNode = JsonNodeFactory.instance.objectNode();
        ObjectNode                  controlPanelNode = JsonNodeFactory.instance.objectNode();

        mainNode.put("version", context.getExhibitor().getVersion());
        mainNode.put("running", "imok".equals(response));
        mainNode.put("backupActive", context.getExhibitor().getBackupManager().isActive());
        mainNode.put("standaloneMode", context.getExhibitor().getConfigManager().isStandaloneMode());
        mainNode.put("extraHeadingText", context.getExhibitor().getExtraHeadingText());
        mainNode.put("nodeMutationsAllowed", context.getExhibitor().nodeMutationsAllowed());

        configNode.put("rollInProgress", context.getExhibitor().getConfigManager().isRolling());
        configNode.put("rollStatus", context.getExhibitor().getConfigManager().getRollingConfigState().getRollingStatus());
        configNode.put("rollPercentDone", context.getExhibitor().getConfigManager().getRollingConfigState().getRollingPercentDone());

        configNode.put("hostname", context.getExhibitor().getThisJVMHostname());
        configNode.put("serverId", (us != null) ? us.getServerId() : -1);
        for ( StringConfigs c : StringConfigs.values() )
        {
            configNode.put(fixName(c), config.getString(c));
        }
        for ( IntConfigs c : IntConfigs.values() )
        {
            String fixedName = fixName(c);
            int value = config.getInt(c);

            configNode.put(fixedName, value);
        }

        EncodedConfigParser     zooCfgParser = new EncodedConfigParser(config.getString(StringConfigs.ZOO_CFG_EXTRA));
        ObjectNode              zooCfgNode = JsonNodeFactory.instance.objectNode();
        for ( EncodedConfigParser.FieldValue fv : zooCfgParser.getFieldValues() )
        {
            zooCfgNode.put(fv.getField(), fv.getValue());
        }
View Full Code Here


    @Path("set-rolling")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
    public Response setConfigRolling(String newConfigJson) throws Exception
    {
        InstanceConfig  wrapped = parseToConfig(newConfigJson);

        Result  result = null;
        try
        {
            PseudoLock  lock = context.getExhibitor().getConfigManager().newConfigBasedLock();
View Full Code Here

    @Path("set")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
    public Response setConfig(String newConfigJson) throws Exception
    {
        InstanceConfig wrapped = parseToConfig(newConfigJson);

        Result  result = null;
        try
        {
            PseudoLock  lock = context.getExhibitor().getConfigManager().newConfigBasedLock();
View Full Code Here

            zooCfgValues.add(new EncodedConfigParser.FieldValue(name, value));
        }
        final String          zooCfgExtraValue = new EncodedConfigParser(zooCfgValues).toEncoded();

        final String          finalBackupExtraValue = backupExtraValue;
        return new InstanceConfig()
        {
            @Override
            public String getString(StringConfigs config)
            {
                switch ( config )
View Full Code Here

    }

    @VisibleForTesting
    void doWork() throws Exception
    {
        InstanceConfig  config = exhibitor.getConfigManager().getConfig();
        StateAndLeader  stateAndLeader = getStateAndLeader();
        InstanceState   instanceState = new InstanceState(new ServerList(config.getString(StringConfigs.SERVERS_SPEC)), stateAndLeader.getState(), new RestartSignificantConfig(config));

        currentIsLeader.set(stateAndLeader.isLeader());

        exhibitor.getConfigManager().checkRollingConfig(instanceState);
View Full Code Here

    }

    @VisibleForTesting
    void adjustConfig(final String newSpec, String leaderHostname) throws Exception
    {
        final InstanceConfig currentConfig = exhibitor.getConfigManager().getConfig();
        InstanceConfig newConfig = new InstanceConfig()
        {
            @Override
            public String getString(StringConfigs config)
            {
                if ( config == StringConfigs.SERVERS_SPEC )
View Full Code Here

        );
    }

    private int getBackupPeriodMs()
    {
        InstanceConfig config = exhibitor.getConfigManager().getConfig();
        return config.getInt(IntConfigs.BACKUP_PERIOD_MS);
    }
View Full Code Here

    final String zooKeeperJarPath;
    final Properties properties;

    Details(Exhibitor exhibitor) throws IOException
    {
        InstanceConfig config = exhibitor.getConfigManager().getConfig();

        this.zooKeeperDirectory = getZooKeeperDirectory(config);
        this.dataDirectory = new File(config.getString(StringConfigs.ZOOKEEPER_DATA_DIRECTORY));

        String      logDirectory = config.getString(StringConfigs.ZOOKEEPER_LOG_DIRECTORY);
        this.logDirectory = (logDirectory.trim().length() > 0) ? new File(logDirectory) : this.dataDirectory;

        configDirectory = new File(zooKeeperDirectory, "conf");
        logPaths = findJar(new File(zooKeeperDirectory, "lib"), "(.*log4j.*)|(.*slf4j.*)");
        zooKeeperJarPath = findJar(this.zooKeeperDirectory, "zookeeper.*");
 
View Full Code Here

    private volatile ConfigCollection       collection = new PropertyBasedInstanceConfig(new Properties(), new Properties());
    private final AtomicInteger             version = new AtomicInteger(0);

    void setConfig(final StringConfigs type, final String value)
    {
        final InstanceConfig config = collection.getRootConfig();
        final InstanceConfig newConfig = new InstanceConfig()
        {
            @Override
            public String getString(StringConfigs configType)
            {
                if ( configType == type )
View Full Code Here

        };
    }

    void setConfig(final IntConfigs type, final int value)
    {
        final InstanceConfig config = collection.getRootConfig();
        final InstanceConfig newConfig = new InstanceConfig()
        {
            @Override
            public String getString(StringConfigs configType)
            {
                return config.getString(configType);
View Full Code Here

TOP

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

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.