Package com.netflix.discovery.shared

Examples of com.netflix.discovery.shared.Application


            throw new IllegalArgumentException(
                    "Supplied VIP Address and application name cannot both be null");
        } else if (vipAddress != null && appName == null) {
            return getInstancesByVipAddress(vipAddress, secure);
        } else if (vipAddress == null && appName != null) {
            Application application = getApplication(appName);
            if (application != null) {
                result = application.getInstances();
            }
            return result;
        }

        String instanceVipAddress;
View Full Code Here


    private synchronized void updateInstanceRemoteStatus() {
        // Determine this instance's status for this app and set to UNKNOWN if not found
        InstanceInfo.InstanceStatus currentRemoteInstanceStatus = null;
        if (instanceInfo.getAppName() != null) {
            Application app = getApplication(instanceInfo.getAppName());
            if (app != null) {
                InstanceInfo remoteInstanceInfo = app.getByInstanceId(instanceInfo.getId());
                if (remoteInstanceInfo != null) {
                    currentRemoteInstanceStatus = remoteInstanceInfo.getStatus();
                }
            }
        }
View Full Code Here

                    applications = remoteApps;
                }

                ++deltaCount;
                if (ActionType.ADDED.equals(instance.getActionType())) {
                    Application existingApp = applications
                            .getRegisteredApplications(instance.getAppName());
                    if (existingApp == null) {
                        applications.addApplication(app);
                    }
                    logger.debug("Added instance {} to the existing apps in region {}",
                            instance.getId(), instanceRegion);
                    applications.getRegisteredApplications(
                            instance.getAppName()).addInstance(instance);
                } else if (ActionType.MODIFIED.equals(instance.getActionType())) {
                    Application existingApp = applications
                            .getRegisteredApplications(instance.getAppName());
                    if (existingApp == null) {
                        applications.addApplication(app);
                    }
                    logger.debug("Modified instance {} to the existing apps ",
                                 instance.getId());

                    applications.getRegisteredApplications(
                            instance.getAppName()).addInstance(instance);

                } else if (ActionType.DELETED.equals(instance.getActionType())) {
                    Application existingApp = applications
                            .getRegisteredApplications(instance.getAppName());
                    if (existingApp == null) {
                        applications.addApplication(app);
                    }
                    logger.debug("Deleted instance {} to the existing apps ",
View Full Code Here

     * Returns the eureka server which this eureka client communicates with.
     *
     * @return - The instance information that describes the eureka server.
     */
    private InstanceInfo getCoordinatingServer() {
        Application app = getApplication(DISCOVERY_APPID);
        List<InstanceInfo> discoveryInstances = null;
        InstanceInfo instanceToReturn = null;

        if (app != null) {
            discoveryInstances = app.getInstances();
        }

        if (discoveryInstances != null) {
            for (InstanceInfo instance : discoveryInstances) {
                if ((instance != null)
View Full Code Here

        if (_shutdown || ApplicationInfoManager.getInstance().getInfo().getStatus() == InstanceStatus.DOWN) {
            return Collections.<String, List<String>>emptyMap();
        }

        /* Get a list of EVCACHE instances from the DiscoveryManager */
        final Application app = DiscoveryManager.getInstance().getDiscoveryClient().getApplication(_appName);
        if (app == null) {
            return Collections.<String, List<String>>emptyMap();
        }

        final List<InstanceInfo> appInstances = app.getInstances();
        final Map<String, List<String>> instancesSpecific = new HashMap<String, List<String>>();

        /* Iterate all the discovered instances to find usable ones */
        for (InstanceInfo iInfo : appInstances) {
            final DataCenterInfo dcInfo = iInfo.getDataCenterInfo();
View Full Code Here

    protected String getSocketAddressForNode(MemcachedNode node) {
        String result = socketAddresses.get(node);
        if (result == null) {
            if (node.getSocketAddress() instanceof InetSocketAddress) {
                final InetSocketAddress isa = (InetSocketAddress) node.getSocketAddress();
                final Application app = DiscoveryManager.getInstance().getDiscoveryClient().getApplication(appName);
                if (null == app) {
                    throw new IllegalStateException("No instances found for registered application");
                }
                final List<InstanceInfo> instances = app.getInstances();
                for (InstanceInfo info : instances) {
                    if (info.getHostName().equalsIgnoreCase(isa.getHostName())) {
                        final String hostName = info.getHostName();
                        final String ip = info.getIPAddr();
                        final String port = info.getMetadata().get("evcache.port");
View Full Code Here

        if (discoveryClient == null) {
            LOG.error("Error getting discovery client");
            throw new RuntimeException("Failed to create discovery client");
        }

        Application app = discoveryClient.getApplication(applicationName);
        List<Host> hosts = Lists.newArrayList();
       
        if (app == null) {
            return hosts;
        }
       
        List<InstanceInfo> ins = app.getInstances();
       
        if (ins == null || ins.isEmpty()) {
            return hosts;
        }
       
View Full Code Here

                .getDiscoveryClient();
        if (discoveryClient == null) {
            LOG.warn("Can't instantiate DiscoveryClient - returning localhost");
            return localhost;
        }
        final Application app = discoveryClient.getApplication(appName);
        if (app == null) {
            LOG.warn("Discovery client can't find genie - returning localhost");
            return localhost;
        }

        for (InstanceInfo instance : app.getInstances()) {
            // only pick instances that are UP
            if (instance.getStatus() == null
                    || instance.getStatus() != InstanceStatus.UP) {
                continue;
            }
View Full Code Here

TOP

Related Classes of com.netflix.discovery.shared.Application

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.