Examples of CuratorEntry


Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    }

    @ThriftMethod
    public DiscoveryInstance queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id) throws RpcException
    {
        CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
        @SuppressWarnings("unchecked")
        ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry, discoveryProjection.id, ServiceDiscovery.class);
        try
        {
            return new DiscoveryInstance(serviceDiscovery.queryForInstance(name, id));
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    }

    @ThriftMethod
    public Collection<DiscoveryInstance> queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name) throws RpcException
    {
        CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
        @SuppressWarnings("unchecked")
        ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry, discoveryProjection.id, ServiceDiscovery.class);
        try
        {
            Collection<ServiceInstance<byte[]>> instances = serviceDiscovery.queryForInstances(name);
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    @ThriftMethod
    public RpcCuratorEvent getNextEvent(CuratorProjection projection) throws RpcException
    {
        try
        {
            CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
            RpcCuratorEvent event = entry.pollForEvent(pingTimeMs);
            return (event != null) ? event : new RpcCuratorEvent();
        }
        catch ( InterruptedException e )
        {
            throw new RpcException(e);
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    @ThriftMethod
    public DiscoveryProjection startDiscovery(CuratorProjection projection, final String basePath, DiscoveryInstance yourInstance) throws RpcException
    {
        try
        {
            CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
            final ServiceDiscovery<byte[]> serviceDiscovery = ServiceDiscoveryBuilder
                .builder(byte[].class)
                .basePath(basePath)
                .client(entry.getClient())
                .thisInstance((yourInstance != null) ? yourInstance.toReal() : null)
                .build();
            serviceDiscovery.start();

            Closer closer = new Closer()
            {
                @Override
                public void close()
                {
                    try
                    {
                        serviceDiscovery.close();
                    }
                    catch ( IOException e )
                    {
                        log.error("Could not close ServiceDiscovery with basePath: " + basePath, e);
                    }
                }
            };
            String id = entry.addThing(serviceDiscovery, closer);

            return new DiscoveryProjection(id);
        }
        catch ( Exception e )
        {
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

                strategy = new RoundRobinStrategy<byte[]>();
                break;
            }
        }

        CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
        @SuppressWarnings("unchecked")
        ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry, discoveryProjection.id, ServiceDiscovery.class);
        final ServiceProvider<byte[]> serviceProvider = serviceDiscovery
            .serviceProviderBuilder()
            .downInstancePolicy(new DownInstancePolicy(downTimeoutMs, TimeUnit.MILLISECONDS, downErrorThreshold))
            .providerStrategy(strategy)
            .serviceName(serviceName)
            .build();
        try
        {
            serviceProvider.start();
            Closer closer = new Closer()
            {
                @Override
                public void close()
                {
                    try
                    {
                        serviceProvider.close();
                    }
                    catch ( IOException e )
                    {
                        log.error("Could not close ServiceProvider with serviceName: " + serviceName, e);
                    }
                }
            };
            String id = entry.addThing(serviceProvider, closer);
            return new DiscoveryProviderProjection(id);
        }
        catch ( Exception e )
        {
            throw new RpcException(e);
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    }

    @ThriftMethod
    public DiscoveryInstance getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws RpcException
    {
        CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
        @SuppressWarnings("unchecked")
        ServiceProvider<byte[]> serviceProvider = CuratorEntry.mustGetThing(entry, providerProjection.id, ServiceProvider.class);
        try
        {
            return new DiscoveryInstance(serviceProvider.getInstance());
View Full Code Here

Examples of org.apache.curator.x.rpc.connections.CuratorEntry

    }

    @ThriftMethod
    public Collection<DiscoveryInstance> getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws RpcException
    {
        CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
        @SuppressWarnings("unchecked")
        ServiceProvider<byte[]> serviceProvider = CuratorEntry.mustGetThing(entry, providerProjection.id, ServiceProvider.class);
        try
        {
            Collection<ServiceInstance<byte[]>> allInstances = serviceProvider.getAllInstances();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.