Package com.netflix.exhibitor.core.config

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


{
    @Test
    public void testTempDownInstance() throws Exception
    {
        final AtomicInteger         checkMs = new AtomicInteger(10000);
        InstanceConfig              config = new InstanceConfig()
        {
            @Override
            public String getString(StringConfigs config)
            {
                switch ( config )
View Full Code Here


        this.hostname = hostname;
    }

    public StateAndLeader calculateState() throws Exception
    {
        InstanceConfig          config = exhibitor.getConfigManager().getConfig();

        if ( !isSet(config, StringConfigs.ZOOKEEPER_DATA_DIRECTORY) || !isSet(config, StringConfigs.ZOOKEEPER_INSTALL_DIRECTORY) )
        {
            return new StateAndLeader(InstanceStateTypes.LATENT, false);
        }
View Full Code Here

    @Path("status")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getClusterStatus() throws Exception
    {
        InstanceConfig      config = context.getExhibitor().getConfigManager().getConfig();
        ServerList          serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));

        ClusterStatusTask   task = new ClusterStatusTask(context.getExhibitor(), serverList.getSpecs());
        List<ServerStatus>  statuses = context.getExhibitor().getForkJoinPool().invoke(task);

        GenericEntity<List<ServerStatus>> entity = new GenericEntity<List<ServerStatus>>(statuses){};
View Full Code Here

    @Path("4ltr/{word}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public String getFourLetterWord(@PathParam("word") String word) throws Exception
    {
        InstanceConfig config = context.getExhibitor().getConfigManager().getConfig();

        String      value;
        try
        {
            FourLetterWord.Word wordEnum = FourLetterWord.Word.valueOf(word.toUpperCase());
View Full Code Here

    @Path("list")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public String   getClusterAsJson() throws Exception
    {
        InstanceConfig      config = context.getExhibitor().getConfigManager().getConfig();

        ObjectNode          node = JsonNodeFactory.instance.objectNode();

        ArrayNode           serversNode = JsonNodeFactory.instance.arrayNode();
        ServerList          serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));
        for ( ServerSpec spec : serverList.getSpecs() )
        {
            serversNode.add(spec.getHostname());
        }
        node.put("servers", serversNode);
        node.put("port", config.getInt(IntConfigs.CLIENT_PORT));

        return JsonUtil.writeValueAsString(node);
    }
View Full Code Here

    @Path("list")
    @GET
    @Produces(MediaType.APPLICATION_FORM_URLENCODED)
    public String   getClusterAsExhibitor() throws Exception
    {
        InstanceConfig      config = context.getExhibitor().getConfigManager().getConfig();

        StringBuilder       response = new StringBuilder();

        ServerList          serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));
        response.append("count=").append(serverList.getSpecs().size());

        int                 index = 0;
        for ( ServerSpec spec : serverList.getSpecs() )
        {
            response.append("&server").append(index++).append("=").append(URLEncoder.encode(spec.getHostname(), "UTF-8"));
        }

        response.append("&port=").append(config.getInt(IntConfigs.CLIENT_PORT));

        return response.toString();
    }
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.