Package org.apache.synapse.endpoints

Examples of org.apache.synapse.endpoints.Endpoint


        }

        this.totalWeight = totalWeight;

        for (int i = 0; i < endpoints.size(); i++) {
            Endpoint e = endpoints.get(i);
            if (e instanceof PropertyInclude) {
                PropertyInclude include = (PropertyInclude) e;

                MediatorProperty weight = include.getProperty(
                        LB_WEIGHTED_RRLC_WEIGHT);
View Full Code Here


    public Endpoint getEndpoint(String key) {
        Object o = localEntries.get(key);
        if (o != null && o instanceof Endpoint) {
            return (Endpoint) o;
        } else {
            Endpoint e = getConfiguration().getEndpoint(key);
            synchronized (e) {
                if (!e.isInitialized()) {
                    e.init(synEnv);
                }
            }
            localEntries.put(key, e);
            return e;
        }
View Full Code Here

        LoadbalanceAlgorithm algo = endpoint.getAlgorithm();

        String []firstTwoRoundsResults = new String[34];
        for (int i = 0; i < 34; i++) {
            Endpoint epr = algo.getNextEndpoint(messageContext, null);
            if (epr instanceof AddressEndpoint) {
                firstTwoRoundsResults[i] =
                        ((AddressEndpoint)epr).getProperty(
                                WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT).getValue();
            }
        }

        for (int i = 0; i < 34; i++) {
            assertEquals(firstTwoRoundsExpected[i], firstTwoRoundsResults[i]);
        }

        String []secondTwoRoundsExpected = {
                "6", "6", "6", "6", "5", "5", "5", "5", "5", "5", "5", "3", "3", "3", "3", "2", "2",
                "2", "2", "1", "1", "6", "6", "6", "6", "5", "5", "5", "5", "5", "5", "5", "3", "3"};
        String []secondTwoRoundsResults = new String[34];
        for (int i = 0; i < 34; i++) {
            Endpoint epr = algo.getNextEndpoint(messageContext, null);
            if (epr instanceof AddressEndpoint) {
                secondTwoRoundsResults[i] =
                        ((AddressEndpoint)epr).getProperty(
                                WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT).getValue();
            }
View Full Code Here

            if (entry.getValue() instanceof SequenceMediator) {
                SequenceMediator seq = (SequenceMediator) entry.getValue();
                seq.setDynamic(true);
                seq.setRegistryKey(entry.getKey());
            } else if (entry.getValue() instanceof Endpoint) {
                Endpoint ep = (Endpoint) entry.getValue();
            }

        } else {
            // if the type of the object is known to have a mapper, create the
            // resultant Object using the known mapper, and cache this Object
View Full Code Here

        }

        Map<String, Endpoint> map = childEndpoints.get(root);
        assert endpointNames != null;
        for (String endpointName : endpointNames) {
            Endpoint endpoint = null;
            if (map != null) {
                endpoint = map.get(endpointName);
                if (endpoint == null || endpoints.contains(endpoint)) {
                    map = childEndpoints.get(endpointName);
                    if (map != null) {
View Full Code Here

            log.debug("For session with id " + id + " : expiry time interval : " + expireTimeWindow);
        }

        long expiryTime = System.currentTimeMillis() + expireTimeWindow;

        Endpoint rootEndpoint = endpoints.get(0);

        SessionInformation information = new SessionInformation(id,
                endpoints, expiryTime);

        if (isClustered) {
View Full Code Here

                    " : expiry time interval : " + expireTimeWindow);
        }

        long expiryTime = System.currentTimeMillis() + expireTimeWindow;

        Endpoint rootEndpoint = endpoints.get(0);

        SessionInformation information = new SessionInformation(id,
                currentMember, expiryTime);

        if (isClustered) {
View Full Code Here

        }

        endpointStates = new EndpointState[endpoints.size()];

        for (int i = 0; i < endpoints.size(); i++) {
            Endpoint endpoint = endpoints.get(i);
            if (!(endpoint instanceof PropertyInclude)) {
                EndpointState state = new EndpointState(i, DEFAULT_WEIGHT);
                endpointStates[i] = state;
            } else {
                MediatorProperty property =
View Full Code Here

     * @param algorithmContext The context in which holds run time states related to the algorithm
     * @return endpoint to send the next message
     */
    public Endpoint getNextEndpoint(MessageContext synCtx, AlgorithmContext algorithmContext) {

        Endpoint nextEndpoint;
        int attempts = 0;
        synchronized (algorithmContext) {
            int currentEPR = algorithmContext.getCurrentEndpointIndex();
            do {
                // two successive clients could get the same endpoint if not synchronized.
                nextEndpoint = (Endpoint) endpoints.get(currentEPR);

                if (currentEPR == endpoints.size() - 1) {
                    currentEPR = 0;
                } else {
                    currentEPR++;
                }
                algorithmContext.setCurrentEndpointIndex(currentEPR);

                attempts++;
                if (attempts > endpoints.size()) {
                    return null;
                }

            } while (!nextEndpoint.readyToSend());
        }

        return nextEndpoint;
    }
View Full Code Here

        processAuditStatus(sm,elem);

        OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q);
        if (epElement != null) {
            // create the endpoint and set it in the send mediator
            Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties);
            if (endpoint != null) {
                sm.setEndpoint(endpoint);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.synapse.endpoints.Endpoint

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.