Package com.netflix.exhibitor.core.entities

Examples of com.netflix.exhibitor.core.entities.Result


    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response rollbackRolling() throws Exception
    {
        context.getExhibitor().getConfigManager().cancelRollingConfig(ConfigManager.CancelMode.ROLLBACK);
        return Response.ok(new Result("OK", true)).build();
    }
View Full Code Here


    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response forceCommitRolling() throws Exception
    {
        context.getExhibitor().getConfigManager().cancelRollingConfig(ConfigManager.CancelMode.FORCE_COMMIT);
        return Response.ok(new Result("OK", true)).build();
    }
View Full Code Here

    @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();
            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);
            }
            context.getExhibitor().resetLocalConnection();
        }
        catch ( Exception e )
        {
            result = new Result(e);
        }

        return Response.ok(result).build();
    }
View Full Code Here

    @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();
            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);
            }
            context.getExhibitor().resetLocalConnection();
        }
        catch ( Exception e )
        {
            result = new Result(e);
        }

        return Response.ok(result).build();
    }
View Full Code Here

            {
                recursivelyDelete(path);
            }
            catch ( Exception e )
            {
                response = Response.ok(new Result(e)).build();
                break;
            }

            response = Response.ok(new Result("OK", true)).build();
        } while ( false );

        return response;
    }
View Full Code Here

                    context.getExhibitor().getLog().add(ActivityLog.Type.INFO, String.format("createNode() created node [%s] with data [%s]", path, binaryDataStr));
                }
            }
            catch ( Exception e )
            {
                response = Response.ok(new Result(e)).build();
                break;
            }

            response = Response.ok(new Result("OK", true)).build();
        } while ( false );

        return response;
    }
View Full Code Here

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response newIndex() throws Exception
    {
        context.getExhibitor().getActivityQueue().add(QueueGroups.IO, new IndexProcessorActivity(context.getExhibitor()));
        return Response.ok(new Result("OK", true)).build();
    }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public Response deleteIndex(@PathParam("index-name") String indexName)
    {
        File        indexFile = getLogFile(indexName);
        context.getExhibitor().getIndexCache().markForDeletion(indexFile);
        return Response.ok(new Result("OK", true)).build();
    }
View Full Code Here

        }
        finally
        {
            context.getExhibitor().getIndexCache().releaseLogSearch(logSearch.getFile());
        }
        return Response.ok(new Result("OK", true)).build();
    }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public String stopStartZooKeeper() throws Exception
    {
        context.getExhibitor().getActivityQueue().add(QueueGroups.MAIN, new KillRunningInstance(context.getExhibitor(), true));

        Result result = new Result("OK", true);
        return JsonUtil.writeValueAsString(result);
    }
View Full Code Here

TOP

Related Classes of com.netflix.exhibitor.core.entities.Result

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.