Package com.ericsson.ssa.sip.dns

Examples of com.ericsson.ssa.sip.dns.TargetTuple


        List<TargetTuple> newTTs =
                Arrays.asList(sipBindingCtx.getTargetTuples());

        for (TargetTuple newTT : newTTs) {
            TargetTuple oldTT =
                    pair.getLeft().getTargetTupleForProtocol(newTT.getProtocol());

            if (oldTT != null) {
                if (!oldTT.equals(newTT)) {
                    //remove the old one add the new one
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, "sip.network.grizzly.update.tt",
                                new Object[]{
                            newTT.getProtocol().name(),
                            sipBindingCtx.getContext()
                        });
                    }

                    //Remove
                    Pair<SelectorHandler, SelectorHandler> selHdlPair = pair.getRight().
                            get(newTT.getProtocol());

                    if (selHdlPair != null) { //disable can cause the pair to be absent.                     
                        shutdownAndRemoveSelectorHandlers(newTT.getProtocol(),
                                selHdlPair.getLeft(), selHdlPair.getRight());

                        //Add
                        final ProtocolChain udpProtocolChain =
                                getProtocolChain();

                        ProtocolChainInstanceHandler instanceHandler =
                                new SimpleProtocolChainInstanceHandler(udpProtocolChain);

                        startSelectorHandlers(newTT, selHdlPair,
                                instanceHandler, sipBindingCtx);
                    }

                    oldTTs.remove(oldTT);
                } else {
                //okidoki

                //Check updateSSL, there the SSL changes are taken into

                //account.
                }
            } else {
                //Add it
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "sip.network.grizzly.update.tt",
                            new Object[]{
                        newTT.getProtocol().name(),
                        sipBindingCtx.getContext()
                    });
                }

                final ProtocolChain udpProtocolChain = getProtocolChain();

                ProtocolChainInstanceHandler instanceHandler =
                        new SimpleProtocolChainInstanceHandler(udpProtocolChain);

                Pair<SelectorHandler, SelectorHandler> selHdlPair =
                        new Pair<SelectorHandler, SelectorHandler>();
                startSelectorHandlers(newTT, selHdlPair, instanceHandler,
                        sipBindingCtx);

                pair.getRight().put(newTT.getProtocol(), selHdlPair);
            }
        }

        for (TargetTuple oldTT : oldTTs) {
            //Remove it       
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "sip.network.grizzly.update.remove.tt",
                        new Object[]{
                    oldTT.getProtocol().name(),
                    sipBindingCtx.getContext()
                });
            }

            Pair<SelectorHandler, SelectorHandler> selHdlPair = pair.getRight().
                    remove(oldTT.getProtocol());

            shutdownAndRemoveSelectorHandlers(oldTT.getProtocol(),
                    selHdlPair.getLeft(), selHdlPair.getRight());
        }
    }
View Full Code Here


        if (resp.getNeedSerialization() && resp.isSerialized()){
            return;
        }
        boolean isClbEndpoint = (resp.getRemote() == null) ? false :
            resp.getRemote().getIsCLBEndpoint();
        TargetTuple newTupple = TargetResolver.getInstance().resolveResponse(
                resp);

        if ((newTupple != null) && (newTupple != resp.getRemote())) {
            newTupple.setCLBEndpoint(isClbEndpoint);
            resp.setRemote(newTupple);
        }
    }
View Full Code Here

                    SelectionKey readKey = channel.register(selector,
                            SelectionKey.OP_READ);

                    // Cache the connection.
                    TargetTuple tt = connectionManager.add(readKey, this);

                    outboundConnectionsTuple.put(readKey, tt);
                }

                return false;
View Full Code Here

                        SelectionKey readKey = channel.register(selector,
                                SelectionKey.OP_READ);

                        // Cache the connection.
                        TargetTuple tt = connectionManager.add(readKey, this);

                        outboundConnectionsTuple.put(readKey, tt);
                    }
                } catch (Exception e) {
                    if (logger.isLoggable(Level.FINE)){
View Full Code Here

        SipBindingCtx ctx = SipBindingResolver.instance().
                getActiveInternalContext(transport);
                                             

        if (ctx != null) {
            TargetTuple tt = ctx.getTargetTupleForProtocol(transport);

            if (tt != null) {
                localSAddr = tt.getSocketAddress();

                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER,
                        "Suitable local SipBindingCtx found, using: " + ctx +
                        ", resolved address: " + localSAddr);
View Full Code Here

                LoadbalancerUtil.isAsymmetric()) {
            // The origin request was sent via UDP.
            // There will thus *not* exist a connection between the client and this instance.
            // Resolve the Via and use the resolved address as destination.
            try {
                TargetTuple tt = TargetResolver.getInstance().resolveResponse(response);
                connection = new Connection(tt.getProtocol(), null, new Socket(tt.getIP(), tt.getPort()));
            } catch (Exception e) {
                logger.log(Level.WARNING, "clb.sip.warning.resolve_failed");
                if(logger.isLoggable(Level.FINE)){
                    logger.log(Level.FINE, "clb.caught_an_exception", e);
                }
View Full Code Here

            // Now addrArr[0] = transport, addrArr[1]=IP address and
            // addrArr[2]=port
            if (i == addrArr.length) {
                try {
                    msg.setInitialRemote(
                    new TargetTuple(SipTransports.getTransport(addrArr[0]),
                    addrArr[1], Integer.parseInt(addrArr[2])));
                } catch (NumberFormatException e) {
                    throw new SipRoutingException("Malformed " +
                            Header.PROXY_REMOTE_HEADER, e);
                } catch (Exception e) {
View Full Code Here

    public boolean isStale() {
        return resolver.isStale(this);
    }
   
    public TargetTuple getTargetTupleForProtocol(SipTransports protocol){
        TargetTuple ttOfProto = null;
       
        if (targetTuples!=null) {
            for (TargetTuple tt : targetTuples)  {
                if (tt.getProtocol().ordinal()==protocol.ordinal()) {
                    ttOfProto = tt;
View Full Code Here

            }
           
            if (targetTuples.length ==
                    update.targetTuples.length) {
                for (TargetTuple tt : targetTuples) {
                    TargetTuple updateTT =
                            update.getTargetTupleForProtocol(tt.getProtocol());
                    if (updateTT==null || !tt.getSocketAddress().equals(
                            updateTT.getSocketAddress())) {
                        hints.add(SipBindingCtx.UpdateHint.TARGET_TUPLE_UPDATE);
                        break;
                    }
                }
            } else {
View Full Code Here

                 * and the key has to be cancelled
                 */
                // added this check to prevent FT failures
                if(staleConnectionsTimeout > 0 ) {
                    if (getRole() == Role.CLIENT) {
                        DatagramChannel channel = ((DatagramChannel) key.channel());                    TargetTuple tt = new TargetTuple(SipTransports.UDP_PROT,
                            channel.socket().getInetAddress().getHostAddress(),
                            channel.socket().getPort());
                        if (staleUDPConnections.get(tt) == null){
                            staleUDPConnections.put(tt, System.currentTimeMillis());
                        }
View Full Code Here

TOP

Related Classes of com.ericsson.ssa.sip.dns.TargetTuple

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.